1

Can some one explain the significance of the $ in the following line of aspnet code? Not sure what to look for since I've never seen the syntax but FormView2 is the name of the formview this input sits inside.

Why is this necessary (if it is at all)?

<pre>
    <code>
    <!---test-->
    <input type="text" class="grid_2" id="FormView2_TextBoxName" value="0" name="FormView2$TextBox4">
    <blockquote>
    </pre>
</code>
4
  • You need to edit your question. Looks like you forgot to paste the code. Commented Apr 19, 2011 at 13:47
  • @Joel it's there but the code format is behaving strangely Commented Apr 19, 2011 at 13:47
  • @Tom Gullen: the 1. before the question started a list mode, which breaks code mode completely. Commented Apr 19, 2011 at 13:49
  • Related: stackoverflow.com/questions/4586470/… Commented Apr 19, 2011 at 13:49

2 Answers 2

1

Asp.Net engine attached that to make it a unique ID/Name (I think $ is Name while _ is for ID) in the html, you will see if you add a master page there will be additional information added as well. The server side ID will still be the same though.

You will see on server side you also have uniqueID/ClientID apart from the normal ID property. Have a look here and here for more info

Sign up to request clarification or add additional context in comments.

Comments

0

It looks like this code was output by ASP.net from a server-side Textbox control. The server-side control is rendered using a combination of client-side Javascript code and HTML.

The ID in the HTML code as some characters added to it to make it unique, as the previous poster pointed out. You're probably referring to it as TextBox4 in your server-side ASP.net code. You'll need to use the longer name in your client-side Javascript code (if you use Javascript).

To get that longer ID in your Javascript code, you can write something like this:

var textbox = document.getElementById('<%=Textbox4.ClientID %>');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.