Help functions to Radgrid Insert Command

2 posts, 0 answers
  1. Auvo
    Auvo avatar
    32 posts
    Member since:
    Jul 2011

    Posted 23 Feb Link to this post


    I have used InsertCommand when inserting new rows to the radgrid.


    protected void grvTasks_InsertCommand(object sender, GridCommandEventArgs e)
        var editableItem = ((GridEditableItem)e.Item);
        if (_taskListMain != null)
            Task newTask = new Task(_taskListMain.DataConnections);
            Hashtable values = new Hashtable();
            if (values["Name"] != null)
                newTask.Name = (string)values["Name"];
            if (values["Description"] != null)
                newTask.Description = (string)values["Description"];
            if (values["EstimateInHours"] != null)
                newTask.EstimateInHours = int.Parse(values["EstimateInHours"].ToString());


    I copy data from each field from hashtable to the final class properties. This means lot of rows if there are lot of fields, so I wondering is there another way to copy inserted data from GridEditableItem to final custom class? e.g. Similar function what is use in UpdateCommand ( editableItem.UpdateValues(task);)




  2. Viktor Tachev
    Viktor Tachev avatar
    1438 posts

    Posted 26 Feb Link to this post

    Hi Auvo,

    When using manual CRUD operations you need to extract the values entered by the user and update the corresponding fields in the data source.

    Alternatively you could use Automatic DataSource operations with RadGrid. Note that automatic operations are available only for declarative DataSource controls. Also, the data source should support automatic operations. Check out the following article for additional information on the feature.

    Viktor Tachev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top