.NET Framework 4.6.1
We upgraded our solutions from Infragistics45.Web.v14.1, Version=14.1.20141.2150 to Infragistics45.Web.v15.2, Version=15.2.20152.2042. It introduced an error on our WHDG with a SummaryRow. The grid is on a WebTab. The grid and behaviors are being created on the server in the Grid_Init event. This event executes when the page loads and again on each tab change. The grid columns, behaviors and bands are cleared in the Grid_Init, then built again. The problem with the 15.2 release is the SummaryRow is being built twice.
The order of execution has changed between 14.1 and 15.2. In 14.1 the Grid_Init always executes prior to Page_Init. In 15.2 the Grid_Init executes prior to Page_Init when the page first loads. But on the tab change event, the Page_Init executes first. I do not know if this is connected to the change in behavior but just something I noticed. Any ideas on why this changed? Thanks.
Hello,
Thank you for contacting us and for the provided information.
About your question, there were a lot of changes between 14.1 and 15.2, like issue fixes, Grid performance improvements etc, so I could not tell you exactly what is causing this change. As a suggestion, you could check if the summary row is build and to skip the second build.
Also I can assure you that the event execution wont change soon, as I see the sequence is Grid_Init -> Page_Init -> Page_Load
Thank you for the response. Take your example and add the following to the WebTab.
AutoPostBackFlags-SelectedIndexChanged="On"
You will see when you change tabs the sequence is different. This changed between IG releases.
Page_Init -> Grid_Init
I did get beyond the summary row error by only building the summary row when not isPostBack. But I have encountered another error that I cannot get resolved. It does not appear to be the change in sequence. We have a WebTab that contains 5 tabs with user controls. On the first tab there is an icon that calls a popup. When the popup data is saved, the popup closes and the page behind is refreshed. Then we get a viewstate error. No other changes have been made to our code except the Infragistics upgrade. This worked correctly in 14.1. We have included InstantiateTemplates on all the WebTabs which fixed many of our errors with the upgrade but not this one. Any ideas?
Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
Stack Trace
StackTrace Information--------------------------------------------- at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.AddedControl(Control control, Int32 index) at System.Web.UI.ControlCollection.Add(Control child) at Infragistics.Web.UI.Framework.Data.FlatDataBoundControl.get_TemplateContainerControl() at Infragistics.Web.UI.GridControls.WebDataGrid.InstantiateTemplates() at Infragistics.Web.UI.GridControls.ContainerGrid.EnsureTemplates() at Infragistics.Web.UI.Framework.Data.FlatDataBoundControl.OnPreRender(EventArgs e) at Infragistics.Web.UI.GridControls.WebDataGrid.OnPreRender(EventArgs e) at Infragistics.Web.UI.GridControls.ContainerGrid.OnPreRender(EventArgs e) at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
The WHDG grid data is bound when the WebTab tab is selected. In our case, it is the second tab. If I move the WHDG to the first tab there is no ViewState error.
I've managed to reproduce the described behavior, on tab changing (SelectedIndexChanged server event) a full post back is made (which is caused by AutoPostBackFlags="On") and if you have some kind of a check which tab is clicked, and bind the grid only then, this I causing the exception. After all the Grid is server side control, and the DataSource must be provided on each postback (if it is not bind to SqlDataSource for example), this means that you have two options:
- Bind the Grid
protected void WebTab1_SelectedIndexChanged(object sender, Infragistics.Web.UI.LayoutControls.TabSelectedIndexChangedEventArgs e)
{
//// EnableDataViewState should be set to True for this one
//if (e.NewIndex == 1)
//{
// WebHierarchicalDataGrid1.DataSource = GetTable();
//}
WebHierarchicalDataGrid1.DataSource = GetTable();
}
- EnableDataViewState which will be used to persist the state of the Grid.
<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" EnableDataViewState="true" runat="server" Width="100%" AutoGenerateColumns="False"
OnInit="WebDataGrid_Init" DataMember="Table">
I tried both of your suggestions already. When the page WebTab selected index is changed, the tab index determines which user control to call. EnableDataViewState is set to false so the first thing that happens is the data saved in ViewState is bound to the grid. Turning on EnableDataViewState did not fix the problem either. The only thing that worked was setting the visible property of the grid. I still think this is has to do with the order of execution of the events changing.
Have you tried the sample from my last reply? The error that is thrown is caused exactly by this, that the Grid is not bound again to its data on postback (which is caused by the tab changing).
I can run your sample successfully. I tried this in my project and get the "Failed to load viewstate" error. We normally rebind our grids on the Page.PreLoad event. I moved this the tab SelectedIndexChanged event and still get the same error.
Yes I've noticed the new case and also I have logged this into our internal system, case number "CAS-171821-Y1S4S3" and Work Item #217518.
We could continue our communication through the case only.
Thanks. I tried to update this forum entry yesterday to let you know that I opened a case with my project. The IG site was not responding.
I have logged this behavior in our internal tracking system with a Development ID of 217518. I have associated it with case number CAS-171821-Y1S4S3 , so that you can be notified when the bug is fixed. You can find your active cases under Account - Support Activity in our website. Select your ticket and go to Development Issues tab to view the status of related bugs.
Let me know if I may be of further assistance.
It is not that easy to share a sample because our pages are so complicated but I will try. We have this problem now on 4 different pages. They are all different but have a couple things (that I can see so far) in common, they all have an editable WHDG, a WebTab and broke when we did the IG upgrade.
Could you please share your sample with me then.