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

Pagination Resets Previous Changes.

3 Answers 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ramesh
Top achievements
Rank 1
Ramesh asked on 04 Aug 2015, 12:20 PM

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.

3 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 07 Aug 2015, 06:29 AM
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
0
Ramesh
Top achievements
Rank 1
answered on 07 Aug 2015, 09:36 AM

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.

0
Konstantin Dikov
Telerik team
answered on 11 Aug 2015, 02:28 PM
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
Tags
Grid
Asked by
Ramesh
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Ramesh
Top achievements
Rank 1
Share this question
or