This is a migrated thread and some comments may be shown as answers.

Insert fails with GridEditMode.InPlace

1 Answer 124 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 15 Sep 2011, 07:13 PM
My insert command contains codes like these:

protected void grdcodelist_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
  //Get the GridEditFormInsertItem of the RadGrid
  GridDataInsertItem insertedItem = e.Item as GridDataInsertItem;
  if (insertedItem == null)
  {
    grdcodelist.Controls.Add(new LiteralControl("GridDataInsertItem is null"));
    e.Canceled = true;
    return;
  }
  // process continues
}

GridDataInsertItem is null when the following line is not there
grdcodelist.MasterTableView.EditMode = GridEditMode.InPlace;

I believe the default is EditForms.

With GridEditMode.InPlace, insert works. Update command is not affcted. Update works with or without GridEditMode.InPlace.

Any idea why insert only works with InPlace EditMode and not EditForms?

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 20 Sep 2011, 02:50 PM
Hello Mark,

With EditForms edit mode the insert item type is GridEditFormInsertItem.
Try using different cast for the different edit mode and see if it works thus.

Greetings,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Mark
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or