Passing A Serverside Variable To A Javascript Function In Asp.net
I need to pass a server side variable to my javascript function such as below:
Solution 1:
Got it working like this:
<asp:HyperLink ID="lnkIDNum"
runat="server"
NavigateUrl=<%# "javascript:ChangeLoc('ChangeView', '" + Container.DataItem("IDNum") + "')" %>>
<%#Container.DataItem("IDNum")%>
</asp:HyperLink>
Solution 2:
Try using the Eval() function instead, and do something like this:
<asp:HyperLink ID="lnkEdit" runat="server" NavigateUrl="someFunc('ChangeView', '<%#Eval("SomeColumn")%>');"><%#Eval("SomeColumn")%></asp:HyperLink>
Post a Comment for "Passing A Serverside Variable To A Javascript Function In Asp.net"