Answer the question
In order to leave comments, you need to log in
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
}
}
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question