I have a RadGrid being bound to an in-memory dataset which I persist between request.
A user can edit a row in the grid, and I handle the UpdateCommand event. In this event I'm trying to get the changed values, so I do:
Dictionary<string, object> newValues = new Dictionary<string, object>();
GridEditableItem gridItem = e.Item as GridEditableItem;
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, gridItem);
This code works fine if I bind the data to the dataset in Page_LoadCompleted, but these values will all be blank of I bind the to the dataset in Page_Load.
This makes sense, as Page_LoadCompleted happens after the page events are processed. So in order for me to get the changed values in the grid, I have to make sure I don't bind the dataset to the RadGrid before I've handled page events.
This presents me with a problem. I also have a button that allows users to perform an action which changes the display of the row. I do this by handling the ItemCommand and doing something like:
e.Item.BackColor = System.Color.Red;
This won't work if I'm databinding the grid in Page_LoadCompleted since that will effectively "erase" the color change I made in the ItemCommand since the LoadCompleted event happens after the ItemCommand event.
So what's the best practice/solution here?
A user can edit a row in the grid, and I handle the UpdateCommand event. In this event I'm trying to get the changed values, so I do:
Dictionary<string, object> newValues = new Dictionary<string, object>();
GridEditableItem gridItem = e.Item as GridEditableItem;
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, gridItem);
This code works fine if I bind the data to the dataset in Page_LoadCompleted, but these values will all be blank of I bind the to the dataset in Page_Load.
This makes sense, as Page_LoadCompleted happens after the page events are processed. So in order for me to get the changed values in the grid, I have to make sure I don't bind the dataset to the RadGrid before I've handled page events.
This presents me with a problem. I also have a button that allows users to perform an action which changes the display of the row. I do this by handling the ItemCommand and doing something like:
e.Item.BackColor = System.Color.Red;
This won't work if I'm databinding the grid in Page_LoadCompleted since that will effectively "erase" the color change I made in the ItemCommand since the LoadCompleted event happens after the ItemCommand event.
So what's the best practice/solution here?