Я хочу сделать ссылку регистрации и входа функциональной в ASP.NET проект веб-формы
My task is to create .ASCX control for registration and login and then call this in site.master. And at the same time, want these forms to be appeared as modal pop up. When i click on login then login pop up should appear and the same for registration.If i put <uc:Login ID="ucLogin" runat="server" /> code first then Login works and registration does not and the vice-versa. I think the problem is here:
<uc:Login ID="ucLogin" runat="server" /> <uc1:Registration ID="Registration" runat="server" />
I do not know whether it is good to put <uc1:Registration ID="Registration" runat="server"/> under <asp:LoginView runat="server" ViewStateMode="Disabled"> The whole site.Master page looks like this:
Что я уже пробовал:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="SiteMaster" %> <%@ Register Src = "~/Controls/Login.ascx" TagName = "Login" TagPrefix = "uc" %> <%@ Register Src="~/Controls/Registration.ascx" TagPrefix="uc1" TagName="Registration" %> <!DOCTYPE html> <html lang="en"> <head runat="server"> <asp:PlaceHolder runat="server"> </asp:PlaceHolder> </head> <body> <form runat="server"> <asp:ScriptManager runat="server"> </asp:ScriptManager> <asp:LoginView runat="server" ViewStateMode="Disabled"> <AnonymousTemplate> <ul class="nav navbar-nav navbar-right"> <li> <uc:Login ID="ucLogin" runat="server" /> </li> <li> <uc1:Registration ID="Registration" runat="server" /></li> </ul> </AnonymousTemplate> </asp:LoginView> </div> </div> </div> <div class="container body-content"> <asp:ContentPlaceHolder ID="MainContent" runat="server"> </asp:ContentPlaceHolder> <hr /> </div> </form> </body> </html>
And the Login.ascx is:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Login.ascx.cs" Inherits="Login" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <asp:LinkButton ID="lnkLogin" runat="server" Text="Login"></asp:LinkButton> <asp:Panel ID="pnlLogin" runat="server" CssClass="modalPopup" Style="display: none"> <div class="form-group"> <asp:Label runat="server" AssociatedControlID="Email" CssClass="col-md-3 control-label">User name</asp:Label> <div class="col-md-9"> <asp:TextBox runat="server" ID="Email" CssClass="form-control" /> <asp:RequiredFieldValidator runat="server" ControlToValidate="Email" CssClass="text-danger" ErrorMessage="The user name field is required." /> </div> </div> <div class="form-group"> <asp:Label runat="server" AssociatedControlID="Password" CssClass="col-md-3 control-label">Password</asp:Label> <div class="col-md-9"> <asp:TextBox runat="server" ID="Password" TextMode="Password" CssClass="form-control" /> <asp:RequiredFieldValidator runat="server" ControlToValidate="Password" /> </div> </div> <div class="form-group"> <asp:Button runat="server" OnClick="LogIn" Text="Log in" CssClass="btn btn-default" /> </div> </asp:Panel> <cc1:ModalPopupExtender ID="popup" runat="server" DropShadow="false" TargetControlID="lnkLogin" PopupControlID="pnlLogin" BackgroundCssClass="modalBackground"> </cc1:ModalPopupExtender>
The registration.ascx page looks like this:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Registration.ascx.cs" Inherits="Registration" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc11" %> <asp:LinkButton ID="lnkRegistration" runat="server" Text="Registration"></asp:LinkButton> <asp:Panel ID="pnlRegistration" runat="server"> <div class="form-group"> <asp:Label runat="server" AssociatedControlID="EmailId" CssClass="col-md-2 control-label">Email Address</asp:Label> <div class="col-md-10"> <asp:TextBox runat="server" ID="EmailId" CssClass="form-control" /> <asp:RequiredFieldValidator runat="server" ControlToValidate="EmailId" /> </div> </div> <div class="form-group"> <asp:Label runat="server" AssociatedControlID="Password" CssClass="col-md-2 control-label">Password</asp:Label> <div class="col-md-10"> <asp:TextBox runat="server" ID="Password" TextMode="Password" CssClass="form-control" /> <asp:RequiredFieldValidator runat="server" ControlToValidate="Password" /> </div> </div> <div class="form-group"> <asp:Button runat="server" OnClick="CreateUser_Click" Text="Register" CssClass="btn btn-default" /> </div> </asp:Panel> <cc11:ModalPopupExtender ID="popup1" runat="server" DropShadow="false" TargetControlID="lnkRegistration" PopupControlID="pnlRegistration" BackgroundCssClass="modalBackground" CancelControlID="lnkCancel"> </cc11:ModalPopupExtender>
Richard Deeming
Мы не видим ни ссылки на регистрацию, ни скрипта, который должен срабатывать при нажатии на нее.
Нажмите кнопку "улучшить вопрос" и добавьте соответствующие части вашего кода. Включите полную информацию о любых ошибках, зарегистрированных в консоли ошибок браузера, и не забудьте указать, к какой строке кода они относятся.
Rajeshyadav12
@Ричард, считая, мною были внесены изменения в вопросы и включена и регистрация, и вход в систему управления потребителя. Пожалуйста, взгляните. Заранее спасибо.