Telerik RADGrid - linq and updating

Posted by Dave on Stack Overflow See other posts from Stack Overflow or by Dave
Published on 2010-05-10T03:36:59Z Indexed on 2010/05/10 3:48 UTC
Read the original article Hit count: 937

Filed under:
|

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!

© Stack Overflow or respective owner

Related posts about telerik

Related posts about radgrid