javascript - How to create a modal popup to login when the user is not authenticated? -
I have this view that displays a table of data:
@if (Request IsAuthenticated) {& lt; Fieldet id = "detailPrix" & gt; & Lt; Legend & gt; Details Prix & lt; / Legend & gt; & Lt; Div class = "scroll container" & gt; & Lt; Div class = "scrollingArea" & gt; & Lt; Table class = "screw screw" & gt; & Lt; Thead & gt; & Lt; TR & gt; & Lt; Th & gt; Carburant & lt; / Th & gt; & Lt; Th & gt; Prix & lt; / Th & gt; & Lt; Th & gt; Date d 'invalid & lt; / Th & gt; & Lt; Th & gt; Mettar ¥ and lieutenant; & Lt; / TR & gt; & Lt; / Thead & gt; @for (int index = 0; index & lt; Model.carburants.Count; index ++) {& lt; Tbody & gt; & Lt; TR & gt; & Lt; TD & gt; @html Display name (model carburts [index] .dataautostring ()) & lt; / Td> & Lt; TD & gt; @ Html.DisplayName (Model.prixCarburants [index]. Ostring ()) & lt; / Td> & Lt; TD & gt; @html DisplayName (ModelDataAudgersBarbart [index] ostring ()) & lt; / Td> & Lt; TD & gt; @ Html.ActionLink ("Modifier", "ModifierProject", New {carbuId = Model. Carburants [index] .id, stationId = Model.station.id, Myvmsd = Model, Index = Index, Prix = Model.prixCarburants [index] }) & Lt; / Td> & Lt; / TR & gt; & Lt; / Tbody & gt; } & Lt; / Table & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Fieldset & gt; } Else {// If the user is not authenticated, then I want to display the popup model in login (java or js). } I want to login my login scene in model popup. This is my login view:
& lt; Section id = "loginForm" & gt; & Lt; H2 & gt; Connection Aussie United Nations Local & Lt; / H2 & gt; @Usage (Html.BeginForm (new {ReturnUrl = ViewBag.ReturnUrl}) {@ Html.AntiForgeryToken (@@@@@ HTML) Validity valid (true) gt; legend & gt; formulaire de connectici. & Lt ; / Legend> gt; & lt; li & gt; @HTML.labelfor (m = & gt; m username) @ html textboxphor (m = & gt; m username) @html Validity message (For M = & gt; M Username) & lt; / li & gt; & lt; li & gt; @html.labelfor (m = & gt; m password) @ html password password (m = & Gt; m. Password) @html valid Message (M => M. Password) gt; @HTML checkboxifier (M => M. Rememberme) @HTMLLabelFor (M = & gt; ; M. Remmayer, new {@ class = "checkbox"}) & lt; input id = "login" type = "submit" value = " Sign in "/> For example, is it possible to display this view in a model popup in JQuery? Thanks in advance for any help!
You can try below: VIEW:
& lt ; Div id = "login" & gt; & Lt; Section id = "login form" & gt; & Lt; H2 & gt; Connection Aussie United Nations Local & Lt; / H2 & gt; @Usage (Html.BeginForm (new {ReturnUrl = ViewBag.ReturnUrl}) {@ Html.AntiForgeryToken (@@@@@ HTML) Validity valid (true) gt; legend & gt; formulaire de connectici. & Lt ; / Legend> gt; & lt; li & gt; @HTML.labelfor (m = & gt; m username) @ html textboxphor (m = & gt; m username) @html Validity message (For M = & gt; M Username) & lt; / li & gt; & lt; li & gt; @html.labelfor (m = & gt; m password) @ html password password (m = & Gt; m. Password) @html valid Message (M => M. Password) gt; @HTML checkboxifier (M => M. Rememberme) @HTMLLabelFor (M = & gt; ; M. Remmayer, new {@ class = "checkbox"}) & lt; input id = "login" type = "submit" value = " Sign in "/> & Lt; Script & gt; Var $ login = $ ('# Login') Dialog ({autoOpen: incorrect, title: '', model: true, width: 50, height: 50}); // You need to write button click event to open it $ ('# login button') Click (function () {$ login.dialog ('open');}); & Lt; / Script & gt; If you have any problems please ask.
Comments
Post a Comment