wapt49 wapt49 - 3 months ago 20
Vb.net Question

How to pass evaluated Eval in javascript function

I am very new in VB.NET, Can Evaluated Eval be passed as an argument to a javascript function? If so how I can do that? I need true or false in to be pass on javascript function

onclick='ShowViewPopup(this, "detail", null, null, <%#IIf(String.IsNullOrEmpty(Eval("CustomerNumber"))) %>';


Many Thanks

Answer

Just get rid of IIf, you do not seem to need it. I also recommend output the whole function call with C# code, makes it easier on quotes. So (formatted for better readability):

onclick='<%#
    "ShowViewPopup(this, \"detail\", null, null, "
    + String.IsNullOrEmpty(Eval("CustomerNumber"))
    + ")"
%>'