I
I
Ivan Kurnakov2014-06-04 08:29:36
ASP.NET
Ivan Kurnakov, 2014-06-04 08:29:36

How to change bound collection through RadGrid Telerik?

There is a RadGrid that uses a collection (of type ObservableCollection) from a self-written library as input (binding is set). How can I make the Edit mode so that when the RadGrid changes, the collection itself changes as well? I tried to add the "Auto-generate columns in run-time" flags and similar flags in the RadGrid's Smart Tag, but to no avail - a form appears for modification, you can enter values, click "Update" and no changes occur.
It seems that in the documentation there is an event that is triggered when the fact of modification / insertion occurs:

private void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{   
    if(e.Item is GridDataItem)   
    {    
        //the item is in regular mode 
        GridDataItem dataItem = e.Item as GridDataItem;   
        //do something here 
    }
    else if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {   
        //the item is in edit mode    
        GridEditableItem editedItem = e.Item as GridEditableItem;    
        //do something here  
    }
}

But it is not clear how to understand in which field there was a change and what was changed, which means that changing the collection is also not

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
snuffi, 2014-09-11
@Skinner2170

After finishing editing, you need to write new data to the source, i.e. in your case, send the modified object to your library so that it has updated data:
private void radGridView_RowEditEnded( object sender, Telerik.Windows.Controls.GridViewRowEditEndedEventArgs e )
{
Employee newEmployee = e.NewData as Employee;
if ( newEmployee != null )
{
// send to the library for saving
}
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question