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

RadGrid IsDirty property

4 Answers 178 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Leszek
Top achievements
Rank 1
Leszek asked on 10 Apr 2015, 03:07 PM

Hi,

I have several InPlace editable RadGrids on my page located in an asp:DetailsView (together with other fields). The problem is when users update the grid(s) and do not commit changes by pressing the small Update button in a grid's row. Then, when they press the Update button of DetailsView all their changes are lost.

Is there any way to determine if a grid has any pending changes? Something like RadGrid.IsDirty property?

Thanks,

Leszek

 

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 13 Apr 2015, 12:02 PM
Hello,
 
You can use the built-in batch editing functionality of the grid to achieve your goal. RadGrid's Batch editing functionality enables inline client-side editing and performing multiple changes before the user decides to either apply the changes or cancel them. More information and online example are available below:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/grid-batch-editing.html

Regards,
Pavlina
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Leszek
Top achievements
Rank 1
answered on 13 Apr 2015, 02:06 PM

Thank you Pavlina for your response. I'm aware of batch editing but it does not fit my business requirements. My users need to update one row at a time and commit or cancel changes per row. InPlace editing is perfect for that. Besides, would batch editing allow me to determine if there are any pending (uncommitted) changes in a grid? I need to know that as I have to prevent users from submitting the form using the asp.net DetailsView's Update button. It's also lots of work for me at this point to convert all the grids (which use Ajax etc.) from InPlace mode to Batch mode.

I have another idea and I would appreciate your opinion on that: how about I would attach an onchange JavaScript event to each and every control in a grid and track if there has been any change? This way I would have a centralized place (a hidden field I guess) that would indicate if the onchange event has been fired. This would be my IsDirty property. Is it a good idea?

Thanks,

Leszek

 

0
Pavlina
Telerik team
answered on 15 Apr 2015, 12:00 PM
Hello Leszek,

To track if there has been any change in the grid you can use hasChanges() method of the Batch Editing Manager.
var grid=$telerik.findControl(document,"RadGrid1");
grid.get_batchEditingManager().hasChanges(grid.get_masterTableView());

You can check if the second line returns true or false on button click.

Regards,
Pavlina
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Jaya
Top achievements
Rank 1
answered on 22 Apr 2015, 06:21 AM

Hi

Admin

Can you solve this 

http://www.telerik.com/forums/how-to-designed-the-aspx-page-and-open-rad-window
Tags
Grid
Asked by
Leszek
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Leszek
Top achievements
Rank 1
Jaya
Top achievements
Rank 1
Share this question
or