1

I have a link with this:

OnClientClick='<%# String.Format("openWin({0}, {1}, {2});return false;",DataBinder.Eval(Container,"DataItem.component_id"), DataBinder.Eval(Container,"DataItem.control_id"), 'string value')%> ' />

This is failing because I'm ensure of how to add in the last string variable (indicating by the 'string value')

0

1 Answer 1

2

Try this

OnClientClick='<%# String.Format("openWin({0}, {1}, \"{2}\");
return false;"
,DataBinder.Eval(Container,"DataItem.component_id")
,DataBinder.Eval(Container,"DataItem.control_id")
,"string value")%> ' />

Single quote would cause a

Parser Error Message

since you're also using single quotes for OnClientClick attribute. Escaping quotes with \" should get the job done.

EDIT

Use the following in order to avoid

Compiler Error Message: CS1010: Newline in constant

OnClientClick='<%# String.Format("openWin({0}, {1}, \"{2}\");return false;",DataBinder.Eval(Container,"DataItem.component_id"),DataBinder.Eval(Continer,"DataItem.control_id"),"string value")%> ' />
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for suggestions, this is causing a 'Compiler Error Message: CS1010: Newline in constant' error message
You should remove the new lines in my answer. I've done it like that, so that you can see it clearly. see the updated answer pls.
no problem. kindly mark as answer if it solves the problem so the other people can benefit from it.

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.