done_merson
done_merson

Reputation: 2998

RadGrid trying to keep insert form open after insert

I have a Telerik radgrid which is a basic data entry form.

I want to keep the insert form open after an insert. The user clicks the insert button, the record saves, the grid is still in insert mode.

I can get the grid to open in insert mode by using

RadGrid1.MasterTableView.IsItemInserted = true;

However, no matter where I put this code (page_prerender, oninsert,etc.), when the record is inserted the radgrid goes back to viewing the grid items. I tried to do it client side after load ($(document).ready) but that code doesn't get called.(Probably due to the radajaxmanager overriding it)

   var grid = $find("<%#RadGrid1.ClientID %>");
        grid.get_masterTableView().IsItemInserted = true;

Does anyone know how to keep the insert row template open after an insert?

My next step to is keep a few of the values from the previous insert, so if you know how to do that to please include that.

Upvotes: 1

Views: 3408

Answers (2)

DeBorges
DeBorges

Reputation: 740

You can set e.Canceled = true; in your itemCommand event

Upvotes: 1

Vasyl Senko
Vasyl Senko

Reputation: 1829

You can use next:

<Telerik:RadGrid ID="Grid"
    OnNeedDataSource="NeedDataSource" ..>

NeedDataSource function:

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

Upvotes: 0

Related Questions