Hello,
I have 2 pages, both load their controls dynamically.
each page loads a few controls, one of these controls contains a WebDataGrid bound to test data, setting DataSource to a manually filled list.
Those 2 controls with WebDataGrid are not the same control, but they are actually technically equal.
At Page 1 everyhting works fine.
At Page 2 any time a postback occurs I get the following exception:
Infragistics.Web.UI.GridControls.Behaviors ViewState is corrupted.
bei Infragistics.Web.UI.Framework.ObjectCollection.LoadViewStateItems(ArrayList itemList)
bei Infragistics.Web.UI.Framework.ObjectCollection.LoadViewState(Object savedState)
bei Infragistics.Web.UI.Framework.ObjectCollection.System.Web.UI.IStateManager.LoadViewState(Object savedState)
bei Infragistics.Web.UI.GridControls.WebDataGrid.LoadViewState(Object savedState)
bei System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
bei System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)
bei System.Web.UI.Control.AddedControl(Control control, Int32 index)
bei System.Web.UI.ControlCollection.Add(Control child)
bei Binner.ProjectManager.GraphicalUserInterface.Classes.ContentPage.LoadPageControls(BaseElement baseElement) in N:\ProjectManager\Binner.ProjectManager.GraphicalUserInterface\Classes\ContentPage.cs:Zeile 170.
bei Binner.ProjectManager.GraphicalUserInterface.Classes.ContentPage.OnLoad(EventArgs e) in N:\ProjectManager\Binner.ProjectManager.GraphicalUserInterface\Classes\ContentPage.cs:Zeile 47.
bei Binner.ProjectManager.GraphicalUserInterface.Pages.Workplace.Dependencies.OnLoad(EventArgs e) in N:\ProjectManager\Binner.ProjectManager.GraphicalUserInterface\Pages\Workplace\Dependencies.aspx.cs:Zeile 40.
bei System.Web.UI.Control.LoadRecursive()
bei System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
nothing special in the aspx:
Part of Page 1:
<tr>
<td colspan="3">
<igmisc:WebPanel ID="WebPanel1" runat="server" SkinID="ContentWebPanel" Header-Text="<%$ Resources:Lang, WorkplaceRecordsControl_recordRegistrationWebPanel %>"
Header-TextAlignment="Left">
<Header Text="WorkplaceRecordsControl_recordRegistrationWebPanel" TextAlignment="Left">
</Header>
<Template>
<ig:WebDataGrid ID="recordRegistrationDataGrid" runat="server" SkinID="WebDataGrid" AutoGenerateColumns="False">
<Columns>
<ig:BoundDataField DataFieldName="Date" Key="Date">
<Header Text="Date" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="Duration" Key="Duration">
<Header Text="Duration" />
<ig:BoundDataField DataFieldName="Description" Key="Description">
<Header Text="Description" />
</Columns>
</ig:WebDataGrid>
</Template>
</igmisc:WebPanel>
</td>
</tr>
Part of Page 2 (Erroring):
<ig:WebDataGrid ID="webDataGridProjectDependencies" runat="server"
SkinID="WebDataGrid" AutoGenerateColumns="False">
<ig:BoundDataField DataFieldName="Predecessor" Key="Predecessor">
<Header Text="Predecessor" />
<ig:BoundDataField DataFieldName="PSP" Key="PSP">
<Header Text="PSP" />
<ig:BoundDataField DataFieldName="RelationType" Key="RelationType">
<Header Text="RelationType" />
<ig:BoundDataField DataFieldName="Offset" Key="Offset">
<Header Text="Offset" />
The exception occurs right after I add another control into the control with Controls.AddAt(0, control) int he OnInit() override. (removing this does not help)
So I suspect while trying to load ViewState in LoadViewState() (not overridden) the exception is thrown.
(setting "EnableViewState" = "Disabled", of course, fixed this exception, but not my problem :-))
I am using Volume 2010.3.2134
Need help!
Thanks
Carsten
I have found out that the Skin or the css causes this. Removing only the SkinID fixes the exception.
The Skin and CSS looks like this and I can not see why there is an error in one page but not in the other:
SKIN:
<%@ Register assembly="Infragistics4.Web.v10.3, Version=10.3.20103.2134, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.GridControls" tagprefix="igwdg" %>
<igwdg:WebDataGrid SkinID="WebDataGrid" AutoGenerateColumns="false"
HeaderCaptionCssClass="wdg_HeaderCaption" AltItemCssClass="wdg_AltItem" ItemCssClass="wdg_Item"
runat="server">
<Behaviors>
<igwdg:ColumnResizing Enabled="true" />
<igwdg:Paging PagerAppearance="Bottom" PageSize="10" Enabled="true" />
<igwdg:Sorting SortingMode="Single" Enabled="true">
</igwdg:Sorting>
<igwdg:ColumnMoving DragStyle="Slide">
<ColumnSettings>
<igwdg:ColumnMoveSetting EnableMove="true" />
</ColumnSettings>
</igwdg:ColumnMoving>
</Behaviors>
</igwdg:WebDataGrid>
CSS:
/*Header-Caption*/
.wdg_HeaderCaption
{
text-align: left;
font-size:0.9em;
color:#000;
}
/*Header*/
.igg_Header
background-image:none;
background-color:#DBDBDB;
cursor:pointer;
/*every row*/
tbody.igg_Item>tr>td
background-color:#fff;
/*every second row*/
tbody>tr.igg_Alt>td
background-color:#F2F2F2;
Hello BlueScreenISU,
The SkinID is related to ASP.NET Themes which is consistent layout for server side controls however our controls defines our style out of the box using css only.
Is the error that you're still referring to is "Infragistics.Web.UI.GridControls.Behaviors ViewState is corrupted."? In the case of loading controls dynamically on the page would not track any ViewState so the controls would have to be recreated at every postback.
For knowing any cause of an error I would have to run a sample for reproducing on my local machine.
Let me know if you have any questions with this matter. Thank you.
Hello Duane and thanks for your answer,
the error ist still there.
Of course, the controls are recreated on every postback and also the saved viewstate is restored.
the skin is just adding the behavior for EVERY grid control we use with this skin id. so basically both grids should behave the same, but one is throwing this exception while the others are doing fine.
I tried to remove the behaviors from the skin file and only if I remove all behaviors from the grid it is not throwing the exception, but without sorting, paging features etc...
unfortunatelly it is a huge project and rebuilding this issue for an example might take a really long time. I was hoping for any advice why there could be a difference from control 1 to control 2, and what exactly can corrupt a viewstate.
Thanks for the update.
When recreating controls dynamically upon postbacks you can disable ViewState and check for any differences.
Also within the @page directive you can check to see if setting EnableViewStateMac property to false would make any difference. More information can be found here: http://msdn.microsoft.com/en-us/library/system.web.ui.page.enableviewstatemac.aspx.
This is just a follow up on the thread if you had any questions or need any further assistance with the WebDataGrid.
You can attach the sample in the thread or I can create a private case for this on reproducing the error. I'll follow up on the thread in the next two weeks.
hi,
if I got the time I will try to build a small example app, but I am pretty sure that I can not reproduce this error this way, but I will try.
It is hard to explain what controls are added.
I already explained the page structure in my initial post.
For now, I am in holydays for the next 2 weeks.
later
blue
It would be helpful to provide more information in regards to what controls specifically are being added dynamically. Also I would have to run a sample and reproduce on my machine to determine the cause of such behavior.
In the WebDataGrid has it's own Init server side event. You may be able to add controls dynamically upon postback in the Init event to determine any difference.
as I said before, disabling viewstate for this one control fixes the exception, but I can not use any sorting etc features then.
setting EnableViewStateMac to false did not change anything.
I finally "fixed" the issue by moving all the behaviors, css and attributes for the control from the skin directly to the control in die ascx, but still I can not see why that makes a difference and we need to investigate.
none the less, thanks for your help