Tony L.
Tony L.

Reputation: 19406

How do I force the InsertCommand of a radgrid and a radlistview to complete a pending insert from outside of the grid?

I have a web page with:

My new requirement is the following:

If a user clicks the save button and there are any pending inserts in the RadGrid or the RadListView, then finish inserting them. In other words, the buttons I'm showing below in the grids' insert form has not been clicked.

Currently, the RadGrid insert doesn't insert to the database until it's own save button is clicked: enter image description here

The same is true with the RadListView though the button looks slightly different: enter image description here

Is there a way for me to call the InsertCommand of each grid from the save button that is outside of the grids?

Upvotes: 0

Views: 731

Answers (1)

Tony L.
Tony L.

Reputation: 19406

RadGrid:

myRadGrid.MasterTableView.GetInsertItem().FireCommandEvent("PerformInsert", String.Empty)

RadListView:

myRadListView.InsertItem.FireCommandEvent("PerformInsert", String.Empty)

Caveat: If you have multiple telerik grids/listviews on a page with pending inserts, calling one of these will lose the data in the other so there will be more work to be done if there are multiple grids.

Upvotes: 1

Related Questions