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.
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.
Re: Asp.Net changes the IDs of my HtmlInputs