Results 1 to 3 of 3

Thread: Asp.Net changes the IDs of my HtmlInputs

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2003
    Posts
    89

    Asp.Net changes the IDs of my HtmlInputs

    Hello,
    I have a very simple user control with a HtmlInputText in it. Its code is:

    <input type="text" id="myTextBox" runat="server" />

    The user control is then included on the container page and when I render it, the following html output is produced:

    <input name="myUserControl$myTextBox" type="text" id="myUserControl_myTextBox" value="" />

    I don't want Asp.Net to add the string "myUserControl" to the ID and name attributes of my textbox. Is there a way to prevent this? It's messing up my custom javascripts and it's ugly. I can do without the ViewState if that would solve the problem.
    Thanks.
    - mo! I said MOOOOOOO!!
    - ...yep, that's a cow, alright.

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

    Re: Asp.Net changes the IDs of my HtmlInputs

    You should render your javascripts from your codebehind and you can then substitute the values of the ids using this.myTextBox.ClientID to get the ID that it's going to output to HTML.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2003
    Posts
    89

    Re: Asp.Net changes the IDs of my HtmlInputs

    I see... thanks
    - mo! I said MOOOOOOO!!
    - ...yep, that's a cow, alright.

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