<a id="lblShowTimings"
runat="server"
title='<%# Eval("SHOW_Name") %>'
onclick='PopulateTicketDiv(<%#Eval("SHOW_ID") %>)'> <-- this is the problem
%#Eval("SHOW_Time") %>
</a>
Can Eval be passed as an argument to a javascript function? If so whats the syntax?
eval() is a dangerous function, which executes the code it's passed with the privileges of the caller. If you run eval() with a string that could be affected by a malicious party, you may end up running malicious code on the user's machine with the permissions of your webpage / extension.
An alternative to eval is Function() . Just like eval() , Function() takes some expression as a string for execution, except, rather than outputting the result directly, it returns an anonymous function to you that you can call. `Function() is a faster and more secure alternative to eval().
page.$$eval(selector, pageFunction[, ...args])This method runs Array. from(document. querySelectorAll(selector)) within the page and passes it as the first argument to pageFunction . If pageFunction returns a Promise, then page. $$eval would wait for the promise to resolve and return its value.
Yes. What you want to do is this, though:
onclick='<%# "PopulateTicketDiv(" +Eval("SHOW_ID") + " );" %>'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With