ASP.NET CheckBox runat=“server” name issue

When i using checkbox runat="server" in my asp.net web application. Then browsers have a problem:

Uncaught Syntax error, unrecognized expression: [name=ctl00$ctl00$ContentPlaceHolder1$FormPlaceHolder$CrossFinancing]

ASP.NET code is:

<input type="checkbox" name="CrossFinancing" id="CrossFinancing" runat="server" />

Generated html code is:

<input name="ctl00$ctl00$ContentPlaceHolder1$FormPlaceHolder$CrossFinancing" type="checkbox" id="ctl00_ctl00_ContentPlaceHolder1_FormPlaceHolder_CrossFinancing" />

What is a problem with this name? This is generated by asp.net and browers dont parse this correctly, other controls have '$' in name and this works.

Answers


Why don't you let the ASP.net runtime generate the checkbox for you??

<asp:CheckBox id="chkCrossFinancing" runat="server"/>

The name attribute will be managed by the ASP.net runtime itself.


Need Your Help

yield in list comprehensions and generator expressions

python generator list-comprehension yield generator-expression

The following behaviour seems rather counterintuitive to me (Python 3.4):

if else loop inside a for loop?

java if-statement

On the final part of a project i'm doing for school, I am supposed to use a if-else statement inside a for loop, but I have no idea how to do this. I could just use a huge lot of if-else statements...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.