New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
Switch Between Edit and Insert Modes
You can fine tune the behavior of Telerik RadGrid when inserting/editing items. Consider the scenario below:
Update to Insert mode and Insert to Update mode
This is extended version of the previous case.Here is the new part:You click "Add New Record" button and a new record is inserted in Telerik RadGrid. Then you click the edit button at another record. The selected item goes in edit mode and the insert new record closes. You should modify the setting for the IsItemInserted property of the respective GridTableView:
C#
protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
RadGrid grid = (source as RadGrid);
if (e.CommandName == RadGrid.InitInsertCommandName)
{
grid.MasterTableView.ClearEditItems();
}
if (e.CommandName == RadGrid.EditCommandName)
{
e.Item.OwnerTableView.IsItemInserted = false;
}
}