ContentPlaceHolder and Control's ID

Last post 07-31-2006 7:42 AM by StrongTypes. 1 replies.

Sort Posts:

  • ContentPlaceHolder and Control's ID

    07-31-2006, 5:27 AM
    • Member
      633 point Member
    • ASP.N3T
    • Member since 04-16-2005, 10:56 AM
    • Posts 151

    Hello all,

    I have a problem with ContentPlaceHolder. I have some controls in a ContentPlaceHolder and I wrote some JScript codes for that. When I run my program. JScript code doesn't work. I saw page's source. I see my controls' name's had change. for example:

    ID="Textbox1" --> ID="ctl00_ContentPlaceHolder1_Textbox1"

    So my JScript codes doesn't work. Anybody have a suggest for this problem.  Confused

    I'm realy sorry for my english language.
    Thank in advance

    cheers
  • Re: ContentPlaceHolder and Control's ID

    07-31-2006, 7:42 AM
    • All-Star
      30,698 point All-Star
    • StrongTypes
    • Member since 12-13-2005, 11:21 AM
    • California
    • Posts 6,007
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    The control ID looks like that because MasterPage inherits UserControl which implements INamingContainer. INamingContainer ensures that all child controls have unique IDs. You can get a reference to the controls ID rendered at runtime using the ClientID property.

    Ryan

Page 1 of 1 (2 items)