V
VB Programmer
I am trying to change some webform's 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")
For most pages in my web app it works FINE. But for some new pages it is not
working.
For the ones that work, page.Controls(1).tostring is equal to
"System.Web.UI.HtmlControls.HtmlGenericControl".
For the ones that don't work it's equal to
"System.Web.UI.HtmlControls.HtmlForm" and the CType fails.
Any ideas?
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")
For most pages in my web app it works FINE. But for some new pages it is not
working.
For the ones that work, page.Controls(1).tostring is equal to
"System.Web.UI.HtmlControls.HtmlGenericControl".
For the ones that don't work it's equal to
"System.Web.UI.HtmlControls.HtmlForm" and the CType fails.
Any ideas?