Hi,
I have just started using the Aikido WebDataGrid (Infragistics35.Web.v9.2, Version=9.2.20092.1003) and have been able to successfully display a number of fields bound to an Access data source, and associate one of the columns with a DropDownProvider for editing. This all works fine.
However, I would like to take advantage of the TemplateDataField to add other controls, but have found that I get the following error when I convert one of my fields to a TemplateDataField. Note, this only happens if I include an EditorProvider? If I comment out the EditorProvider, the error disappears? The field I have converted to a TemplateDataFIeld is NOT associated an EditorProvider.
The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.
Any help would be most appreciated.
Thanks
Jon
Hello Jon,
Please contact dev support regarding this problem. Thanks.
This is a completely useless answer.
I'm getting the exact same error in the 2010.1 version of WebDataGrid. So, What's the problem here exactly?
I am having the same issue. I follow the tutorials in the videos available on this site and walk through documentation. I put a bound field on the WebDataGrid and try the page; it works fine. I go back into the designer and make it into a template field so the designer writes the markup for me and then try the page; it throws the same error.
I am using the 2010.1 version as well but on .Net 2.0
same issue for me in 10.1. anyone from Infragistics going to help us out??? and please dont reply with put in a support ticket because I have one from May 6th that still says Awaiting Assignment!!!
Hello Guys,
We apologize for the inconvenience .
I would like to ensure you that I've logged this issue with our dev team a few days ago and now we are working on resolve it. now i will increase its priority and soon as I have information in which service release this will be addressed I will drop a line here.
Thank you !
Hello All,
I've checked this with our Development team and as I promised you , I'm back with more information about this. It appears to be a .NET Framework limitation : "NET framework prevents from adding any controls dynamically to the Form when ASP code blocks are used". This is the case with editor providers they are created dynamically and added to the form.
As a workaround that can be used in this case is not to have <% ...%> (code block) in templates instead assign values into Label control on InitializeRow event handler in code - behind.
Hope this helps you guys.
looks like its deeper than that. i modifed my gird and removed the <%...%> and did the initializerow instead and and its still happening.
below is my grid and server side code
<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" runat="server"
Width="1150px" DataSourceID="WebHierarchicalDataSource1" StyleSetName ="LucidDream"
AutoGenerateBands="False" AutoGenerateColumns="False"
DataMember="Incompletes" Key="Incompletes" DataKeyFields="PartID"
ItemCssClass="CellStyle" >
<GroupingSettings EnableColumnGrouping="True" GroupAreaVisibility="Visible">
<RemoveButton AltText="Ungroup Column"></RemoveButton>
</GroupingSettings>
<Columns>
<ig:TemplateDataField Key="OrderID" Width="50px" Header-Text="Order ID" CssClass="w50" >
<ItemTemplate>
<asp:Label ID="Label2" runat="server" ></asp:Label>
</ItemTemplate>
<Header Text="Order ID"></Header>
</ig:TemplateDataField>
<ig:BoundDataField DataFieldName="OrderID" Key="OrderID2" Width="35px" Hidden="true" CssClass="w35" >
<Header Text="Order ID" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="DateOrdered" Key="DateOrdered" Width="60px" CssClass="w60">
<Header Text="Date Ordered" />
<ig:BoundDataField DataFieldName="Company" Key="Company" Width="60px" CssClass="w60" >
<Header Text="Company" />
<ig:BoundDataField DataFieldName="PartDescription" Key="PartDescription" Width="145px" CssClass="w145" >
<Header Text="Part" />
<ig:BoundDataField DataFieldName="ComingBack" Key="ComingBack" Width="60px" CssClass="w60" >
<Header Text="Coming BK" />
<ig:BoundDataField DataFieldName="Value" Key="Value" DataFormatString="{0:c}" Width="50px" CssClass="w50" >
<Header Text="Value" />
<ig:BoundDataField DataFieldName="Servicer" Key="Servicer" Width="145px" CssClass="w145">
<Header Text="Servicer" />
<ig:BoundDataField DataFieldName="State" Key="State" Width="30px" CssClass="w30">
<Header Text="State" />
<ig:BoundDataField DataFieldName="FUDate" Key="FUDate" Width="70px" CssClass="w70">
<Header Text="Follow Up Date" />
<ig:BoundDataField DataFieldName="FUStatus" Key="FUStatus" Width="100px" CssClass="w100">
<Header Text="Follow Up Status" />
<ig:BoundDataField DataFieldName="Reminder" Key="Reminder" Width="70px" CssClass="w70">
<Header Text="Notes" />
<ig:BoundDataField DataFieldName="PartID" Key="PartID" Hidden="true" Width="0px" CssClass="w0">
<Header Text="PartID" />
<ig:BoundDataField DataFieldName="CustomerNo" Key="CustomerNo" Hidden="true" Width="0px" CssClass="w0">
<Header Text="CustomerNo" />
</Columns>
<CollapseButton AltText="Collapse Row"></CollapseButton>
<ClientEvents Initialize="initGrid" />
<ExpandButton AltText="Expand Row"></ExpandButton>
<Behaviors>
<ig:Activation>
</ig:Activation>
<ig:EditingCore>
<ig:CellEditing>
<EditModeActions MouseClick="Single" />
<ColumnSettings>
<ig:EditingColumnSetting ColumnKey ="FUDate" EditorID ="DatePickerProvider1" />
<ig:EditingColumnSetting ColumnKey ="FUStatus" EditorID ="DropDownProvider1" />
</ColumnSettings>
</ig:CellEditing>
</Behaviors>
</ig:EditingCore>
<ig:Selection RowSelectType="Single">
</ig:Selection>
<ig:Sorting>
</ig:Sorting>
<EditorProviders>
<ig:DatePickerProvider ID="DatePickerProvider1">
</ig:DatePickerProvider>
<ig:DropDownProvider ID="DropDownProvider1">
<EditorControl ID="EditorControl1" DataSourceID="dsFUStatus" DropDownContainerMaxHeight="200px"
EnableAnimations="False" EnableDropDownAsChild="False" TextField="FUStatus"
ValueField="FUStatus" runat="server" Width="200px">
<Button AltText="" />
<DropDownItemBinding TextField="FUStatus" ValueField="FUStatus" />
</EditorControl>
</ig:DropDownProvider>
</EditorProviders>
</ig:WebHierarchicalDataGrid>
Private Sub WebHierarchicalDataGrid1_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Web.UI.GridControls.RowEventArgs) Handles WebHierarchicalDataGrid1.InitializeRow
If e.Row.Items(13).Text.ToString = "10000" Then
e.Row.CssClass = "redForeground"
End If
CType(e.Row.Items(0).FindControl("Label2"), Label).Text = e.Row.Items(1).Text.ToString
CType(e.Row.Items(0).FindControl("Label2"), Label).Attributes.Add("onclick", "OrderInfo('" & e.Row.Items(1).Text.ToString & "');")
End Sub
Hah - so after posting this I thought I'd just play around a bit more and see if I could fix it.
Seems that calling databind on the grid's Init event fixes our problem.
protected void WebHierarchicalDataGrid1_Init(object sender, EventArgs e) { WebHierarchicalDataGrid1.DataBind(); }
We were simply binding to SQLDataSources in the markup and seems this is not enough, need to forcibly databind in the codebehind. It's like the grid is doing some events internally in the wrong order or something and forcing the databind fixes it up.
Anyway, this fixes it for us and hopefully for anyone else out there who comes across this problem.
Over and out.
Does anyone know if this actually got fixed?
We are using 13.1.20131.2107 and have this exact same problem on a WebHierarchicalDataGrid. Removing the <%...%> from the template field doesn't help.
If we have TemplateDataField on its own the grid works fine, if we have DropDownProvider on its own grid works fine.
If we have BOTH, we get this error....
Exception message: 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.
Hi Rado,
Does the Service Release on July 29 include this item?
Also, is there any release note of service release for reference?
Hello guys,
I would like to inform you that this issue has been fixed and it will be available in next service release. A release schedule you could refer here
So do template fields not work at all in the webdatagrid? I'm using 10.2 and as soon as I add a template to a template field I get an error on postback.
<ig:TemplateDataField Key="Img" Header-Text="Img"> <ItemTemplate> <asp:Label ID="Label1" runat="server">blah</asp:Label> </ItemTemplate> <Header Text="Img" /> </ig:TemplateDataField>
<ig:TemplateDataField Key="Img" Header-Text="Img">
<asp:Label ID="Label1" runat="server">blah</asp:Label>
<Header Text="Img" />
Removing the item template causes the error to go away.