Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Seems like this should be easy but I must just be missing something... I have a Telerik RadGrid on a page that allows inline editing. How do I programatically put the grid into edit mode to insert a new row into the grid. When the page loads I would like show the existing data and also display 1 empty row that a user can easily type into to add a new record to the table. (I don't want them to have to push the add new button)

like image 911
Todd Avatar asked Nov 24 '09 19:11

Todd


3 Answers

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

RadGrid1.MasterTableView.IsItemInserted = true;
RadGrid1.Rebind();
like image 185
Todd Avatar answered Oct 30 '22 02:10

Todd


Lifesaver!!

You can set

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

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

like image 30
Bobby Avatar answered Oct 30 '22 00:10

Bobby


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;
}
like image 21
Vasyl Senko Avatar answered Oct 30 '22 00:10

Vasyl Senko