我想使RadGrid的项目在页面加载时可编辑。我在这里尝试过两种方法http://www.telerik.com/help/aspnet/grid/grddefaulteditmodeforgriditemsoninitialload.html
但都没有任何作用。

例如,下面显示的第二种方法(在ItemCreated事件上设置了Edit属性)将导致将Edit模式设置为true(由调试器验证),但对显示页面时的结果没有影响。

有人知道我在做什么错吗?

protected void RadGrid1_ItemCreated(object sender, Telerik.WebControls.GridItemEventArgs e)
{
    if (!Page.IsPostBack && e.Item is GridEditableItem)
   {
       e.Item.Edit = true;
   }
}

最佳答案

这有效:

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

07-27 23:22