c# - asp:ImageButton doesn't work as expected -
i have problem asp.net imagebutton control.
what is: when click on image redirect login page of google, facebook or twitter, doesn't happen. code login page:
<section id="socialloginform"> <h2>use service log in.</h2> <uc:openauthproviders runat="server" id="openauthlogin" /> <asp:listview runat="server" id="providerdetails" itemtype="microsoft.aspnet.membership.openauth.providerdetails" selectmethod="getprovidernames" viewstatemode="disabled"> <itemtemplate> <asp:imagebutton id="login" runat="server" width="40" height="40" imageurl='<%# item.extradata["icon"] %>' alternatetext="log in using <%#: item.providerdisplayname %> account." /> </itemtemplate> <emptydatatemplate> <p>there no external authentication services configured. </p> </emptydatatemplate> </asp:listview> </section>
this code behind:
public partial class login : page { protected void page_load(object sender, eventargs e) { registerhyperlink.navigateurl = "register.aspx"; openauthlogin.returnurl = request.querystring["returnurl"]; var returnurl = httputility.urlencode(request.querystring["returnurl"]); if (!string.isnullorempty(returnurl)) { registerhyperlink.navigateurl += "?returnurl=" + returnurl; } } public string returnurl { get; set; } public ienumerable<providerdetails> getprovidernames() { return openauth.authenticationclients.getall(); }
you can add list view "onitemcommand" command aspx page
<asp:listview runat="server" id="providerdetails" itemtype="microsoft.aspnet.membership.openauth.providerdetails" selectmethod="getprovidernames" viewstatemode="disabled" onitemcommand="listview_onitemcommand"> <itemtemplate> <asp:imagebutton id="login" runat="server" width="40" height="40" imageurl='<%# item.extradata["icon"] %>' alternatetext="log in using <%#: item.providerdisplayname %> account." commandname="login" /> </itemtemplate> <emptydatatemplate> <p> there no external authentication services configured. </p> </emptydatatemplate> </asp:listview>
code behind
protected void listview_onitemcommand(object sender, listviewcommandeventargs e) { if (string.equals(e.commandname, "login")) { // ever want } }
source :http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listview.itemcommand.aspx
Comments
Post a Comment