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.
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,
Did this issue ever reach a resolution? I've got the exact same problem but it has only surfaced in migrating from 2008.3 to 2009.1
I've got an UltraGrid control which i'm binding to a DataSet in code. The UltraGrid has a number of columns where AllowUpdate is set to yes and the values can be updated. On clicking a asp:button i'm interating through the UltraGrid.Rows collection to retrieve the values of each cell. I'm not rebinding the grid and EnableViewState is on in both the page and the UltraGrid itself.
Previously, i'd iterate through the cells and the edited cells would contain the new values, now (since upgrading to 9.1 - literally replacing the 8.3 UltraGrids with the 9.1 versions) when i iterate through the cells i'm getting the original values or null values for blank cells.
Has something changed between 8.3 and 9.1?
ThanksSteven
Hello,
The setup seems correct to me, from what I can tell. The only thing that comes to my mind is EnableViewState - please make sure you have set EnableViewState to true for the grid and for the page it is contained in.
If this does not help, maybe contacting Developer Support directly is the best idea. Developer Support can be reached at:
http://ko.infragistics.com/Support/#Overview
Please find the below code that is used to bind the webgrid grdResults.
{
// Initialize non-update panel controls
hdnOverrideFlag.Value = "0";
// Get the QueryString Values
hdnKitId.Value = Request.QueryString["kitId"];
// Load list
loadList();
}
try
long caseId = 0;
kitId = Convert.ToInt32(hdnKitId.Value); //Request.QueryString["kitId"]);
caseId = Convert.ToInt64(hdnCaseId.Value); //Request.QueryString["caseId"]);
if (results[0].Rows.Count > 0)
txtFacility.Text = Convert.ToString(results[1].Rows[0]["Facility"]);
txtRep.Text = Convert.ToString(results[1].Rows[0]["Rep"]);
grdResults.Clear();
grdResults.DataSource = results[2];
grdResults.DataBind();
Regards,
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.