1
Answer

how to invoke javascript function in a asp listview button

Ask a question
Guido Lindner

Guido Lindner

11y
2.4k
1
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)