The Eval
function needs double-quotes, so you have to wrap the attribute value in single quotes.
You can't mix static content and <%# ... %>
blocks in a single property value for a control with runat="server"
, so you need to build the entire string within a single <%# ... %>
block.
Within a string in a <%# ... %>
block, you can use '
to insert a single quote:
EDIT That only works in .NET 4.0; in 2.0, it generates &apos;
, which won't work. Use double-quotes instead:
onclick='<%# string.Format(
"ShowEditCriteriaFilterDialog(\"{0}\", \"{1}\")",
Eval("intSMCID"), Eval("strDescription")) %>'
Depending on your data, you might also need to encode the string value for JavaScript:
onclick='<%# string.Format(
"ShowEditCriteriaFilterDialog(\"{0}\", \"{1}\")",
Eval("intSMCID"),
HttpUtility.JavaScriptStringEncode(Eval("strDescription", "{0}"))) %>'
(Code wrapped for readability - it needs to be on a single line.)