c# - How to make a “asp:Button” work inside a “mmenu nav “ -
i’m trying integrate “jquery.mmenu” in visual studio project.
seems “asp:button” not work inside “mmenu nav “.
nor "asp:linkbutton" seems perform.
take specific case of login:
<%@ page language="c#" autoeventwireup="true" codebehind="default.aspx.cs" inherits="test._default" %> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <script src="scripts/jquery-2.1.4.min.js"></script> <script src="scripts/jquery-ui-1.11.4.min.js"></script> <script src="scripts/jquery.mmenu.min.all.js"></script> <link href="content/themes/base/all.css" rel="stylesheet" /> <link href="content/themes/base/jquery.mmenu.all.css" rel="stylesheet" /> <title></title> <script> $(document).ready(function () { $("#login").mmenu({ }); }); </script> </head> <body> <div> <form id="form1" runat="server"> <a href="#login">open login pannel</a><br /> <asp:loginstatus id="loginstatus1" runat="server" logoutaction="redirect" logintext="login" logouttext="logout" logoutpageurl="~/" /><br /> <nav id="login"> <div> <asp:label id="usernamelabel" runat="server">user:</asp:label><br /> <asp:textbox id="usernametextbox" runat="server"></asp:textbox><br /> <asp:label id="passwordlabel" runat="server">password:</asp:label><br /> <asp:textbox id="passwordtextbox" runat="server" textmode="password"></asp:textbox><br /> <asp:button id="loginbutton" runat="server" clientidmode="static" text="login button" onclick="loginbutton_click" /><br /> <asp:linkbutton id="loginlinkbutton" runat="server" clientidmode="static" onclick="loginlinkbutton_click">login linkbutton</asp:linkbutton> </div> </nav> </form> </div> </body> </html>
code behind looks like:
using system; using system.web.security; namespace test { public partial class _default : system.web.ui.page { protected void page_load(object sender, eventargs e) { } protected void loginbutton_click(object sender, eventargs e) { if (membership.validateuser(usernametextbox.text, passwordtextbox.text)) { formsauthentication.redirectfromloginpage(usernametextbox.text, false); } } protected void loginlinkbutton_click(object sender, eventargs e) { if (membership.validateuser(usernametextbox.text, passwordtextbox.text)) { formsauthentication.redirectfromloginpage(usernametextbox.text, false); } } } }
the asp:button not post back.
asp:linkbutton not login.
there way have working?
thanks.
web forms of time change name of element , jquery needs exact name find button. add property button , test again
clientidmode="static"
Comments
Post a Comment