How do I programatically put telerik rad grid in “add new” mode on page load

做~自己de王妃 提交于 2019-12-03 06:24:43
Todd

Found the answer while back.... updating this in case others need it

RadGrid1.MasterTableView.IsItemInserted = true;
RadGrid1.Rebind();

Lifesaver!!

You can set

radGrid1.MasterTableView.IsItemInserted = false;
radGrid1.Rebind();

that will remove the inserted item (like pressing cancel).

Vasyl Senko

If you need show inset form always you can use next:

protected void NeedDataSource(object sender, GridNeedDataSourceEventArgs e) {
  parametersGrid.DataSource = data;
  parametersGrid.MasterTableView.IsItemInserted = true;
}

You could try using jQuery to press your add button once the page is ready.

Something along the lines of -

$(document).ready(function() {
    $("#addButton").click();
}

What I did when I wanted to do the same with the Telerik grid is to set the MasterTableView.IsItemInserted property of the control to true inside the OnNeedDataSource event handler. I suppose that it should work if you set the property inside the OnDataBound grid handler as well.

Dick

jacob mathew
RefreshGrid(userName, "priority", true, false);
RadGrid radGrid = RadGrid1;
radGrid.MasterTableView.InsertItem(); 
radGrid.Rebind();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!