Batch editing in Grid

2 posts, 0 answers
  1. Mohamed
    Mohamed avatar
    2 posts
    Member since:
    May 2016

    Posted 04 May 2016 Link to this post

    Hi there! 
    i have RadGrid that i want it to be edited by user in run time which allows him to delete ,insert,and update then i have to perform this changes on the entity database so how can i do this 
    how can i insert new row and get the data that inserted in each field on it
    how can i get the updates

    i tried this code but it returns the old data not the new one which i add by editting

     foreach (GridDataItem editedItem in RadGrid1.Items)
                        Hashtable newValues = new Hashtable();
                        //The GridTableView will fill the values from all editable columns in the hash
                       int i=int.Parse( editedItem.GetDataKeyValue("id").ToString());
                       akaratCBContext conn = new akaratCBContext();
                       Product p = conn.Products.Where(prd => == i).FirstOrDefault();
                      p.ProductName= newValues["ProductName"].ToString();
                      p.Description= newValues["Description"].ToString();}

  2. Stefan Nenchev
    Stefan Nenchev avatar
    540 posts

    Posted 09 May 2016 Link to this post

    Hi Mohamed,

    Please review the following articles from our documentation page for more information on how to insert new row in RadGridView:

    - Adding New Entries
    - Adding Rows

    As for getting the newly added item, you can use the RowEditEnded event and get the new data through the e.NewData argument. I have added a sample project for your reference. 

    Stefan Nenchev
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top