Skip to content Skip to sidebar Skip to footer

Evaluate Expression Inside Js Function Argument

I am using the OnClientClick event to call a javascript function, I want to pass an argument which is the result of an evaluated expression, something like this OnClientClick='JsFu

Solution 1:

That's an invalid way to combine string and some code. Here is a valid version:

OnClientClick='<%# String.Format("JsFunction({0})", Eval("csproperty")) %>'

The idea is to put whole formatting of the attribute value inside <%# %>.

Post a Comment for "Evaluate Expression Inside Js Function Argument"