asp.net mvc 3 - Refresh partialview in _Layouts.cshtml -


i have following partial view:

<span>login status</span> @{     if (viewbag.userid > 0)     {         @html.actionlink("log out", "logout", "home", null);     }     else {         @html.actionlink("log in", "login", "home", null);     } } 

it's pretend login status area. now, idea have appear in master page mvc site, appears on pages. here's how i'm rendering in _layout.cshtml file:

<div id="login">    @{ html.renderpartial("loginstatus"); } </div> 

what i'd have is, when user clicks either "log in" or "log out" links, action performed (to log user in/out) , partial view refreshed - the rest of page left alone.

at moment, when click of links, site navigates "home/login" or "home/logout". don't want render view, i'd refresh partial view, regardless of page i'm on.

what suggested way this?

cheers. jas.

you use ajax. use jquery unobtrusively ajaxify links subscribing click event , sending ajax request corresponding controller action return partial view , update dom.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -