Question: Change page.Controls(1) from HtmlForm to HtmlGenericControl

V

VB Programmer

I have 2 webforms. When I print out the page.Controls(1).tostring variable
one says "HtmlForm", the other "HtmlGenericControl". How can I change the
first one to "HtmlForm"?

? page.Controls(1).tostring
"System.Web.UI.HtmlControls.HtmlForm"

? page.Controls(1).tostring
"System.Web.UI.HtmlControls.HtmlGenericControl"

The reason why is that I am trying to change the forms background color
based on a value in my web.config file.

This is how I am doing it:
' set background color based on web.config setting
Dim Body As New HtmlGenericControl
Body = CType(Page.Controls(1), HtmlGenericControl)
Body.Attributes("bgcolor") =
ConfigurationSettings.AppSettings("BackgroundColor")
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top