Reputation: 25
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')
Upvotes: 1
Views: 241
Reputation: 2221
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")%> ' />
Upvotes: 2