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

Discussion in 'ASP .Net' started by VB Programmer, Mar 5, 2004.

  1. 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")
     
    VB Programmer, Mar 5, 2004
    #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.
Similar Threads
  1. Jeff Dockman
    Replies:
    0
    Views:
    473
    Jeff Dockman
    Nov 17, 2003
  2. VB Programmer
    Replies:
    0
    Views:
    410
    VB Programmer
    Mar 4, 2004
  3. Martin Eyles
    Replies:
    3
    Views:
    5,872
    Martin Eyles
    Apr 5, 2005
  4. Laser Lu
    Replies:
    14
    Views:
    10,426
    William F. Robertson, Jr.
    May 4, 2005
  5. Laser Lu

    How to get the HtmlForm element of an ASP.NET Page?

    Laser Lu, May 3, 2005, in forum: ASP .Net Building Controls
    Replies:
    16
    Views:
    474
    Laser Lu
    May 10, 2005
Loading...

Share This Page