Hello I am binding Javascript Function with Asp.net linkButton.
But i am facing the issue with calling functionality of the Javascript function.
function AddToDatabase(url) {
alert(url);
}
<asp:LinkButton ID="lnkBtn" CommandName ="sendLink" runat="server"
OnClientClick='javascript:AddToDatabase("' <%# Eval("myUrl") %> '")'
CommandArgument='<%# Eval("myUrl") %>' Text='<%# Eval("myUrl") %>'>'
<%# Eval("myUrl") %>'</asp:LinkButton>
It shows me error Server tag not well formed.
Edit 1
change OnClientClick as follows
combining both
References
Passing Eval parameter to a JavaScript function from ASPX file
Edit 2
Here is another link
Passing variables to javascript in onclientclick
passing a rowindex from gridview item click to javascript function
Edit 3
The one which helped answerer by the @moiz