L
Lars Netzel
I have manually written an achor in the HTML mode like this:
<a name="expenses"></a>
Then at a button_click() I have this code in the code behind:
Page.Controls.Add(New LiteralControl("<script language = ""javascript"">"))
Page.Controls.Add(New LiteralControl("document.location.hash=""expenses"""))
Page.Controls.Add(New LiteralControl("</script>"))
----------------------------------------------------
This normaly works fine but not on this page cause I have added some own
javascript with errortexts that comes from <%... %> links... so I get the
following error message when clicking the button.
The Controls collection cannot be modified because the control contains code
blocks (i.e. <% ... %>).
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The Controls collection cannot
be modified because the control contains code blocks (i.e. <% ... %>).
Source Error:
Line 680: btnAddnewLodging.Enabled = False
Line 681:
Line 682: Page.Controls.Add(New LiteralControl("<script language =
""javascript"">"))
Line 683: Page.Controls.Add(New
LiteralControl("document.location.hash=""lodging"""))
Line 684: Page.Controls.Add(New LiteralControl("</script>"))
------------------
This of course is bad and I need to find another way of adding the
"#expenses" to the URL.. and why is the javascript I wrote considered to be
part of the control i'm adding?
Please help
Best Regards/
Lars Neztel
<a name="expenses"></a>
Then at a button_click() I have this code in the code behind:
Page.Controls.Add(New LiteralControl("<script language = ""javascript"">"))
Page.Controls.Add(New LiteralControl("document.location.hash=""expenses"""))
Page.Controls.Add(New LiteralControl("</script>"))
----------------------------------------------------
This normaly works fine but not on this page cause I have added some own
javascript with errortexts that comes from <%... %> links... so I get the
following error message when clicking the button.
The Controls collection cannot be modified because the control contains code
blocks (i.e. <% ... %>).
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The Controls collection cannot
be modified because the control contains code blocks (i.e. <% ... %>).
Source Error:
Line 680: btnAddnewLodging.Enabled = False
Line 681:
Line 682: Page.Controls.Add(New LiteralControl("<script language =
""javascript"">"))
Line 683: Page.Controls.Add(New
LiteralControl("document.location.hash=""lodging"""))
Line 684: Page.Controls.Add(New LiteralControl("</script>"))
------------------
This of course is bad and I need to find another way of adding the
"#expenses" to the URL.. and why is the javascript I wrote considered to be
part of the control i'm adding?
Please help
Best Regards/
Lars Neztel