Telerik RADGrid - linq and updating
- by Dave
Hi
Telerik's RADGrid, basing on their example on http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/programaticlinqupdates/defaultcs.aspx
Problem: I can insert and delete, however updating doesn't work. No error trapped. Data just doesn't change.
From the code below it looks like Telerik Grid is doing some kung-fu behind the scenes to wire things up. I can't see the db receiving any update statements.
Question: anything obvious I'm missing?
protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e)
{
var editableItem = ((GridEditableItem) e.Item);
var raceId = (Guid) editableItem.GetDataKeyValue("RaceID");
//retrive entity form the Db
var race = DbContext.races.Where(n => n.raceid == raceId).FirstOrDefault();
if (race != null)
{
//update entity's state
editableItem.UpdateValues(race);
try
{
//submit chanages to Db
DbContext.SubmitChanges();
}
catch (Exception f)
{
ShowErrorMessage(f);
}
}
}
Think I may have to go back to their example.. get their db.. and attack from that point of view.
Cheers!