This is a migrated thread and some comments may be shown as answers.

Cancel Changes returns RebindGrid

4 Answers 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 27 Sep 2016, 07:13 PM

In BatchEdit mode when clicking "Cancel Changes" CommandName returns "RebindGrid" and not Cancel. What do I need to do to receive Cancel on server side when Cancel Changes is clicked?

 

 

4 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 30 Sep 2016, 11:04 AM
Hello Daniel,

Note that when using Batch editing all changes are stored on the client. In case you rebind the grid all changes will be lost. For this purpose the Cancel button simply fire the Redind method and for this purpose the CommandName is RebindGrid.
Could you please elaborate a little bit more on your scenario in order to try provide an alternative approach?

Regards,
Kostadin
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Daniel
Top achievements
Rank 1
answered on 30 Sep 2016, 11:47 AM

The grid is in a popup so when clicking on Cancel, I would like to Cancel and close the page. If Cancel does not work this way, how can I cancel and close?

 

0
Kostadin
Telerik team
answered on 05 Oct 2016, 07:38 AM
Hello Daniel,

A possible solution is to override the click event of the Cancel Changes button and close the window manually. Please check out the following code snippet which demonstrates how to hook OnClientClick event of the button.
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if(e.Item is GridCommandItem)
    {
        GridCommandItem commandItem = e.Item as GridCommandItem;
        (commandItem.FindControl("CancelChangesButton") as LinkButton).OnClientClick = "closeAndRebind()";
    }
}
function closeAndRebind()
{
    // your loging to close the window.
}

Regards,
Kostadin
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Daniel
Top achievements
Rank 1
answered on 05 Oct 2016, 04:53 PM
Thank you, that works
Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or