Guido Lindner

Guido Lindner

  • NA
  • 1
  • 3.2k

how to invoke javascript function in a asp listview button

Jun 1 2013 6:36 AM
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:

<asp:ListView runat="server" ID="providerDetails" ItemType="Microsoft.AspNet.Membership.OpenAuth.ProviderDetails"
        SelectMethod="GetProviderNames" ViewStateMode="Disabled">
        <ItemTemplate>
            <button runat="server" type="submit" name="provider" value="<%#: Item.ProviderName %>"
                title="Log in using your <%#: Item.ProviderDisplayName %> account.">
                <%#: Item.ProviderDisplayName %>
            </button>

        </ItemTemplate>
    
        <EmptyDataTemplate>
            <div class="message-info">
                <p>There are no external authentication services configured. See <a href="http://go.microsoft.com/fwlink/?LinkId=252803">this article</a> for details on setting up this ASP.NET application to support logging in via external services.</p>
            </div>
        </EmptyDataTemplate>
    </asp:ListView>

Here is an example of the javascript:
<script type="text/javascript">
        function login() {}
</script>

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

Answers (1)