Skip to content

How to invoke javascript function in a asp listview button

Guido Lindner

Asked Jun 1, 2013, 2:36 AM EDT1 answer
Share
LinkedInX
Hi, I am very new to asp and I use a asp:listview control to list the providers a user can use to log into my website using buttons:

        SelectMethod="GetProviderNames" ViewStateMode="Disabled">
       
           
                title="Log in using your <%#: Item.ProviderDisplayName %> account.">
                <%#: Item.ProviderDisplayName %>
           

       
    
       
           
               

There are no external authentication services configured. See this article for details on setting up this ASP.NET application to support logging in via external services.

           
       
   

Here is an example of the javascript:

This is probably a dumb question but how would I call the javascript function when one of the listview buttons are clicked?

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Sunny  Sharma
    0
    Hi Guido,

    use this code inside your button_Click event:

    ScriptManager.RegisterClientScriptBlock(Button1, typeof(Button), "messageBlock", "login();", true);


    Hope this helps :)

    Thanks.
    0