views:

66

answers:

2

How can I make the following inline c# work within javascript? I have had no luck with escape characters, but I am sure I'm just doing something wrong.

var inputId = "<%= applicationForm.FindControl("myInput").ClientID %>";
+6  A: 

You can simply use single quotes in JavaScript to define String literals:

var inputId = '<%= applicationForm.FindControl("myInput").ClientID %>';
CMS
+2  A: 

your line should work. try this too:

var inputId = '<%= applicationForm.FindControl("myInput").ClientID %>';
Gregoire