Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HTML
<input id="<%=d.DistrictName %>" name="<%=d.DistrictName %>" onclick="SearchDistict(<%= d.DistrictName%>);" type="checkbox" value="<%=d.DistrictId %>"><%=d.DistrictName %>



onclick="SearchDistict(<%= d.DistrictName%>);" 

----------------------|--------------------|
-----------------syntaxerror--------------Sntaxerror
Posted
Updated 5-Jul-15 19:23pm
v2

1 solution

You need to use single quotes as it is string as parameter.

Change this
onclick="SearchDistict(<%= d.DistrictName%>);" 

to
onclick="SearchDistict('<%= d.DistrictName%>');" 
 
Share this answer
 
Comments
amt kumar rai 6-Jul-15 1:59am    
onclick="SearchDistict('<%= d.DistrictName%>');"

show error unterminated string constant
Sreekanth Mothukuru 6-Jul-15 3:10am    
May be your string contains quotes in between!!

Either use double quotes or single quotes to format the parameter or sanitize your "District Name" not to have special symbols

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900