Hi,
I need to save data in the grid when the user modifies and clicks on an asp button. But, the grid doesnot persist data when coming into the click event - it is losing its state on postback. Please assist me on how I can achieve the functionality.
My Grid:
<igtbl:UltraWebGrid ID="grdResults" EnableViewState="true" runat="server" OnUpdateRowBatch="grdResults_UpdateRowBatch" SkinID="CorePagingGrid" OnInitializeLayout="grdResults_InitializeLayout" OnInitializeRow="grdResults_InitializeRow"> <DisplayLayout> <ClientSideEvents CellClickHandler="grdResults_CellClick" /> </DisplayLayout> </igtbl:UltraWebGrid>
Thanks in advance,
Perumal.R
How are you populating your grid with data? I see that you're not setting teither the DataSource or DataSourceID property in the markup, so you're either binding it programmatically or are manually creating rows to directly add to the grid. Which are you doing, and in what event?
If you're binding to a data source, the most likely cause of this is that you're calling DataBind() again on a postback when you don't need to. This will cause data to be re-loaded, and events to not function.
If you're manually creating data, the most likely cause is that you're creating your row objects in a way that they're not stored in ViewState. Create new UltraGridRow objects using the constructor that takes a boolean, pass true as that value, then add the new row to your grid - don't use the grid's Rows.Add() method to actually create the row.
Vince McDonald"] If you're manually creating data, the most likely cause is that you're creating your row objects in a way that they're not stored in ViewState. Create new UltraGridRow objects using the constructor that takes a boolean, pass true as that value, then add the new row to your grid - don't use the grid's Rows.Add() method to actually create the row.
Can you give an example of this? I'm in a similar situation where I am manually creating rows and the data does not persist after a postback. I'm using the Rows.Add() method currently.
advancedmp said:Can you give an example of this?