Hello,
I saw the same questions on this forum but they have had not replies so I'm asking the question again.
This is what I get when try to run app with grid:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
I set DataSource property from codebehind and data source is a simple dataset.
Any ideas? I use v10.3
Thank you.
I am getting this same error. This is my markup and im binding to a anonymous type, but it shouldn't matter.
<div align="center" style="width: 100%" > <table> <ig:WebGroupBox ID="wgbPayOnInvoice" runat="server" Text="Pay On Invoice" Width="98%"> <Template> <ig:WebDataGrid ID="wdgPayOnInvoice" DataKeyFields="IKey" runat="server" AutoGenerateColumns="true" Height="350px" Width="100%"> <Columns> <ig:BoundDataField Key="IKey" DataFieldName="IKey" Hidden="true" /> <ig:BoundDataField Key="BillNumber" DataFieldName="BillNumber"> <Header Text="Bill Number" /> </ig:BoundDataField> <ig:BoundDataField Key="LabCode" DataFieldName="LabCode"> <Header Text="Lab" /> </ig:BoundDataField> <ig:BoundDataField Key="InvoiceNumber" DataFieldName="InvoiceNumber"> <Header Text="Invoice Number" /> </ig:BoundDataField> <ig:BoundDataField Key="TransactionAmount" DataFieldName="TransactionAmount" DataFormatString="{0:C0}"> <Header Text="Total" /> </ig:BoundDataField> <ig:BoundDataField Key="Balance" DataFieldName="Balance" DataFormatString="{0:C0}"> <Header Text="Balance" /> </ig:BoundDataField> </Columns> </ig:WebDataGrid> </Template> </ig:WebGroupBox> </table> </div>
This is the full error.
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).] System.Web.UI.ControlCollection.Add(Control child) +11035338 Infragistics.Web.UI.Framework.AppStyling.CssBuilder.OnPreRenderComplete(Object sender, EventArgs e) +646 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +11057422 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3672
Anyone have any ideas?
I found the issue with my webdatagrid. I removed this from my markup and it worked. Not sure why this is causing a issue.
<ig:BoundDataField Key="IKey" DataFieldName="IKey" Hidden="true" />
Hope this helps.
The problem is I don't have any data fields in markup. I just set AutoGenerateColumns to true and that's all.
Anyone please respond! More than 2 weeks passed but still no response. I could wait 2 weeks because of vacation, and now I must go on but I can't. Please reply.
HI dprosko,
What are you doing to the grid in the code-behind? Do you have template columns? Or do you have server side code in JS?
regards,
David Young
I do NOTHING at all. Here is my markup and code-behind:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ZSheetPage.ascx.cs"
Inherits="UpeWeb.ASPNET.Pages.ZSheetPage" %>
<%@ Register Assembly="Infragistics4.Web.v10.3, Version=10.3.20103.1013, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
Namespace="Infragistics.Web.UI.GridControls" TagPrefix="grid" %>
Namespace="Infragistics.Web.UI.NavigationControls" TagPrefix="ig" %>
<%@ Register src="../Controls/FilterListDialogButton.ascx" tagname="FilterListDialogButton" tagprefix="uc1" %>
<script type="text/javascript">
function menuItemClick(sender, args) {
if (args.getItem().get_key() == "btnMacros" || args.getItem().get_key() == "btnFilterListDialog")
args.set_cancel(true);
}
</script>
<asp:UpdatePanel ID="ZSheetPanel" runat="server">
<ContentTemplate>
<div id="zsheetContainer" runat="server">
<grid:WebHierarchicalDataGrid runat="server" ID="ZSheetGrid" Height="350px" Width="600px">
</grid:WebHierarchicalDataGrid>
</div>
</ContentTemplate>
</asp:UpdatePanel>
protected void Page_Load(object sender, EventArgs e)
{
if (_zsheet != null)
LoadMacroList();
ZSheetGrid.DataSource = _zsheet.ZSInfo.data; // data is of type List<>
Hi,
Thank you for reply.
Now I'm using 2011.1 so problem perhaps somewhere in your code.
As I said previously, your code looked ok to me. Have you tried upgrading to the latest Service Release for 10.3 to see if the issue is resolved there. Or contact Developer Support so they can walk through your sample and attempt to locate the problem.
thanks,Dave
Do you have any news about this problem?
I got the same error in WebDataGrid. Problem starts when I set Hidden property to true on some columns which contain GUIDs. When all columns are visible, everything is ok. Any ideas?
I just tried all this with WebDataGrid and it runs fine. Problem starts when I try to use WebHierarchicalDatagrid