Pagination Resets Previous Changes.

4 posts, 0 answers
  1. Ramesh
    Ramesh avatar
    18 posts
    Member since:
    Apr 2015

    Posted 04 Aug 2015 Link to this post

    Hi Team,

    I am using radgrid in "put all fields in edit" mode, achieving through the below code .
            protected void RadGrid1_PreRender(object sender, EventArgs e)
            {
                RadGrid1.AllowMultiRowEdit = true;
                RadGrid1.MasterTableView.EditMode = GridEditMode.InPlace;
                foreach (GridDataItem dataItem in RadGrid1.Items)
                {
                    dataItem.Edit = true;
                }
                RadGrid1.Rebind();
             }​

     

    Also I have a button to read and store the modification to the DB.

    Now I am facing a critical issue! ,Example , I am changing a value in page 1 (not saving to the DB) and moving to next page ( by Pagination) and back to Page 1.

    now my modified value is lost it shows the old value .

    I am creating my grid pragmatically, Since my grid contains template column , I used "Page init" method to create my grid.

    Datatable is used as Radgrid Datasource.

    Ref : "http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/defining-structure/creating-a-radgrid-programmatically"

    Is there any way to persist my previous modified value after pagination ?

    Regards

    Ramesh.

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2447 posts

    Posted 07 Aug 2015 Link to this post

    Hello Ramesh,

    The behavior that you are describing is expected and when a complex operation like paging, sorting, filtering, etc. is performed, the grid will recreate its structure and you will lose the data.

    The only valid solution that you have for this requirement is to inform the user about the pending changes or use a confirmation window to allow the user to decide whether to continue with the paging or not.


    Regards,
    Konstantin Dikov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Ramesh
    Ramesh avatar
    18 posts
    Member since:
    Apr 2015

    Posted 07 Aug 2015 in reply to Konstantin Dikov Link to this post

    Thank you for your prompt response.

    Can I get radgrid edited state in to a session variable ?

    Example: My grid (Edit all fields mode) I am modifying a field and clicking next page option from pagination.
    Now I am planning to store the modified grid status to a session variable(intention is to access the modified grid in Page_Init() itself  before it triggers PageindexChanged() event.

    Can I achieve it? Because grid is not bound after my edit value changes.

    Regards
    Ramesh.

  4. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2447 posts

    Posted 11 Aug 2015 Link to this post

    Hi Ramesh,

    You could try to traverse all items within the Page's Load event handler, retrieve and store the values, but you will have to consider the page index and ensure that no items are deleted or inserted, because this will break you logic.

    Once again, have in mind that this is not supported scenario and I would personally recommend that you inform the user that there are unsaved changes and avoid such implementation for storing the values.


    Regards,
    Konstantin Dikov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top