Search code examples
asp.netbuttononclientclick

Asp.Net 3.5 Button OnClientClick Argument


I'm trying to call the MyJavascriptFunction(arg1) from an asp button and it's doesn't work...

<asp:Button ID="btnMyButton" runat="server"
            OnClientClick='<%# Eval("Id", "MyJavascriptFunction({0})") %>' />

The html generated contains no OnClick event at all.


Solution

  • Could you write this method in your Page_Load event

    Page.Databind();
    

    and this button is under another data control ?