Controls collection cannot be modified because control contains code blocks (i.e. <% ... %>).

Discussion in 'ASP .Net' started by Dan, May 27, 2006.

  1. Dan

    Dan Guest

    Hi,

    I get this error:
    "Controls collection cannot be modified because the control contains code
    blocks (i.e. <% ... %>). "
    when trying to create a table in the code-behind file like this:
    dim t as table
    t = New Table()
    Page.Controls.Add(t)
    while the aspx file contains this:
    <body>
    amount of records: <%=rec%>
    <form id="form1" runat="server">
    </form>
    </body>

    My question is: why is it not possible to create e.g. a table in an aspx
    file when there is somewhere code blocks?

    Thanks
    Dan
     
    Dan, May 27, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page