Undo Changes to WebGrid 7 in Batch Edit Mode WebGrid 7.0

1 reply. Last post: April 12, 2010 4:50 AM by Yudi
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback

Hi, 

I am using WebGrid 7.0 in a user control that forms a part of .aspx page. The Webgrid is used to show data based on the options user select in the tree view control which is a part of the .aspx page, by setting a different datasource for the same webgrid.

My Questions are 

1) When there are unsaved pending changes to a grid, and if I want to assign a new datasource to the grid, how can I undo the changes that are aready made to the grid. On the server side I have a method like

public void Clear()

{

      foreach(WebGridRowChanges row in WebGrid1.GetChanges())

      {

        row.RowState = RowState.UnModified;

      }

}

Doing the above before assigning the new datasource to the webgrid, clears the edited styling from the grid when the new data is rendered on the WebGrid, but the grid still shows having "{0} pending changes".  Is there something I need to execute at the client side as well, to undo all the pending changes associated with the grid. I am aware of the methods on the client side which you can use like 

WebGrid1.UndoChanges() or WebGrid.RootTable.UndoAllChanges(), but I do not know the exact WebGrid event on the client side where I should call this method. I tried to call the WebGrid1.UndoChanges() method on the client side event of "AfterInitialize()" but it did not work. It only works if I call using a setTimeOut() method on the client side, as I guess it does some synchronization on the client side to restore the pending changes after it executes "AfterInitialize" event on the client side.


2) I am using a feature provided by WebGrid 7, by which a pop shows up asking the user to confirm if they really want to navigate away from the page, if there are pending changes to the grid. BUT the problem is that the pop up appears TWICE. I do not understand why, is it because the grid is being used inside a user control, and that control is a part of an aspx page ?


Please reply asap.


Thanks

Dhaval



All times are GMT -5. The time now is 11:33 PM.
Previous Next