Telerik RadGrid - How do I default to edit mode?

别等时光非礼了梦想. 提交于 2019-12-04 04:59:14
Mr. Flibble

This works:

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

This also works:

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

the code below can be used if you'd like 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();  
}  
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!