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
Hello,
Can you please post your code behind as well? Especially the bits where you bind the grid. From what I see, most probably as Vince said the grid gets bound before raising the UpdateRow events -- that is why they are not called.
Thanks for your reply.
I am setting DataSource of the webgrid and binding it. I am loading the webgrid only when Not Postback. Even then the webgrid is not having data after postback event. Please assist me in this regard.
Thanks,
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.