开发者

Unknown Asp.net syntax

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$TextBo开发者_高级运维x4">
    <blockquote>
    </pre>
</code>


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


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 %>');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜