0

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 %>";
1
  • 1
    Unless the ClientID-property contains a quote, your code is fine. Or at lease the line you posted. Commented Nov 25, 2009 at 17:27

2 Answers 2

7

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

var inputId = '<%= applicationForm.FindControl("myInput").ClientID %>';
Sign up to request clarification or add additional context in comments.

Comments

2

your line should work. try this too:

var inputId = '<%= applicationForm.FindControl("myInput").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.