Telerik RadGrid - How do I change the default mode?

I want to make the elements of my RadGrid editable when the page loads. I tried both methods here http://www.telerik.com/help/aspnet/grid/grddefaulteditmodeforgriditemsoninitialload.html but have no effect.

The second method, for example, shown below, where the Edit property is set in the ItemCreated event, forces you to change the editing mode to true (checked by the debugger), but it does not affect the results when the page is displayed.

Anyone have any ideas what I'm doing wrong?

protected void RadGrid1_ItemCreated(object sender, Telerik.WebControls.GridItemEventArgs e) { if (!Page.IsPostBack && e.Item is GridEditableItem) { e.Item.Edit = true; } } 
+7
telerik gridview radgrid
source share
3 answers

It works:

 for (int i = 0; i < RadGrid1.PageSize; i++) { RadGrid1.EditIndexes.Add(i); RadGrid1.Rebind(); } 
+8
source share

This also works:

 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { e.Item.Edit = true; } 
+7
source share

the code below can be used if you want to do as described above, but for child tables:

 protected void RadGrid1_PreRender(object sender, EventArgs e) { foreach (GridDataItem item in RadGrid1.MasterTableView.Items) { if (item.HasChildItems) { GridTableView childTable = (GridTableView)item.ChildItem.NestedTableViews[0]; foreach (GridDataItem childitem in childTable.Items) { //Check for the newly inserted row //and set in edit mode //childitem.Edit=true; } } } RadGrid1.MasterTableView.Rebind(); } 
+1
source share

All Articles