Results 1 to 2 of 2

Thread: HtmlGenericControl?

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    HtmlGenericControl?

    I had to change the title of the page, depending upon the "mode" querystring variable.

    For this, I tried


    Code:
    <title runat="server" id="MyTitle">whatever</title>
    And then tried to set the value in CodeBehind.

    VB Code:
    1. Me.MyTitle....

    But it wouldn't work.

    I then did a little search and found out I had to add this:

    VB Code:
    1. Protected MyTitle As System.Web.UI.HtmlControls.HtmlGenericControl

    and then set it's InnerHTML property.

    Why did I have to do this "HTMLGenericControl" thing?

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    In order to access a server control from your code-behind, you either have to create a public/protected control declaration or use the FindControl() method. There is not a one-to-one mapping for all the server controls and html controls, so the one's that do not have an associated server control, get to use the html generic control.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width