Put All Items in Edit Mode
There are cases in which you may want to force the grid items in edit mode when the grid displays initially on the page.This is a straightforward task. You simply need to attach to the PreRender event of the control, traverse the items in the grid, detect those which are editable and set their Edit property to true. After traversing all items and performing this operation, you have to rebind the grid (calling explicitly its Rebind() method) to reflect the changes.
Keep in mind you need to enable multi row editing by setting RadGrid's AllowMultiRowEdit property to true.
In the code-behind:
protected void RadGrid1_PreRender(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
foreach (GridItem item in RadGrid1.MasterTableView.Items)
{
if (item is GridEditableItem)
{
GridEditableItem editableItem = item as GridDataItem;
editableItem.Edit = true;
}
}
RadGrid1.Rebind();
}
}
Another option (which is applicable only with in-forms edit mode (EditForms, WebUserControl or FormTemplate custom edit form) is to set the Edit property of all grid rows to true on initial load hooking the ItemCreated event:
Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated
If (Not Page.IsPostBack AndAlso TypeOf e.Item Is GridEditableItem) Then
e.Item.Edit = True
End If
End Sub
Thus you will avoid the grid rebinding on PreRender.