Cancel Changes returns RebindGrid

5 posts, 0 answers
  1. Daniel
    Daniel avatar
    11 posts
    Member since:
    Mar 2014

    Posted 27 Sep Link to this post

    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?

     

     

  2. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 30 Sep Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Daniel
    Daniel avatar
    11 posts
    Member since:
    Mar 2014

    Posted 30 Sep in reply to Kostadin Link to this post

    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?

     

  5. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 05 Oct Link to this post

    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.
  6. Daniel
    Daniel avatar
    11 posts
    Member since:
    Mar 2014

    Posted 05 Oct in reply to Kostadin Link to this post

    Thank you, that works
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017