Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdate partial view on partial view's action
    primarykey
    data
    text
    <p>I am working just one week with ASP.NET MVC 3. This might be a very basic question or someone might have asked similar question before. I am seeking help to show me right path/method to accomplish the problem I am facing getting the partial view designed.</p> <p>I have created a partial view login (in side bar) as below. What I would like to achieve here is, when I hit the "login" button, I must be a able update the partial view with information such as</p> <p>**Welcome [UserName]</p> <p>Last SuccessFul Login : [DateTime]</p> <p>Member Since : [Date]**</p> <p>I am not sure if I need to create another partial view to display this information Or the login partial view can be updated on the fly based on the action.</p> <h2>Login Partial View</h2> <pre><code>@model AlanBeezLab.Models.LoginModel @using (Ajax.BeginForm("Login","UserLogin", new AjaxOptions { UpdateTargetId =Model.UserName })) { &lt;div &gt;User Name @Html.TextBox(" ") &lt;/div&gt; &lt;div&gt;Password @Html.Password(" ") &lt;/div&gt; &lt;p&gt;&lt;input type="submit" value="Let me in!" /&gt;&lt;/p&gt; } </code></pre> <h2>Below is the _Layout.cshtml</h2> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;@ViewBag.Title&lt;/title&gt; &lt;!--link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /&gt;--&gt; &lt;link href="@Url.Content("~/Content/SiteStyle.css")" rel="stylesheet" type="text/css" /&gt; &lt;script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="Header" style="background-image: url('/Content/Images/Banner_Final3.png'); background-repeat:no-repeat; width :1500px; height : 150px;" &gt; &lt;/div&gt; &lt;div id="SideBar"&gt; @Html.Partial("UserControls/UserLogin", new AlanBeezLab.Models.LoginModel()) &lt;/div&gt; &lt;div id="Content"&gt; @RenderBody() &lt;/div&gt; &lt;div id="Footer"&gt; &lt;p&gt;Copyright &amp;copy; XXXXX&lt;/p&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <h2>Below is the Login Controller</h2> <pre><code>public class UserLoginController : Controller { // // GET: /UserLogin/ public ActionResult Index() { return View(); } public ActionResult LogIn() { return [Not Sure]; } </code></pre> <p>I am not sure if this is best/right approach to accomplish this. I would appreciate if I am directed to the right path/approach.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload