Thank you for the response, but that solution doesn't work very well for me. I am dynamically inserting controls into my page (form), so when I use <%= xx %> strings, .NET gives me errors saying that I can't dynamically add/change controls in a form that uses those string types. Any ideas? Error I am getting when trying to add one of my javascript controls called 'ClearFieldControl' is below. I have many controls that I add dynamically to my pages to reduce my coding overhead. Thanks for your help!
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 299: objLiteral.Text = objStringBuilder.ToString
Line 300: objLiteral.ID = "ClearFieldControl"
Line 301: objPageObject.Controls.Add(objLiteral)
Line 302: objLiteral = Nothing
Line 303: objStringBuilder = Nothing
|