MVC partial view (partial) displays changes before and after login and the shared folder does not appear in Solution Explorer

Source: Internet
Author: User

The shared folder was not displayed in my Solution Explorer at first, but the shared folder actually exists in the project, and I searched it as if there were no similar answers (perhaps the keywords I searched for were not accurate enough). Later I saw the next vs2012.

In fact, the solution is simple:

First, view-"Solution Explorer." In Solution Explorer, click on the red box in the "Show All Files" box.

Then you'll see a file similar to the one in the picture, find what you want, right-click, and click "Include in Project" in the Red box.

MVC partial view shows changes before and after landing

And the effect is like this

Pre-logon:;

After landing:

First, right-click the shared folder and add the view: (e.g.)

In the partial view:

<%@ Control language="C #"inherits="System.Web.Mvc.ViewUserControl"%> <%if(session["Nickname"] ==NULL)      { %> <ulclass="Logintop"> <li><a href="<%=url.action ("Login","Account")%>"Rel="nofollow"> Login </a></li> <li>|</li> <li><a href="<%=url.action ("Register","Account")%>"Rel="nofollow"> Registration </a></li> </ul><%}  Else  { %> &LT;DLclass="Collapsible_menu"> <dt> <span id="nowrap"><%=session["Nickname"]%></span> <span id="Noticedot" class="Red DN"></span> <i></i> </dt> &lt ;DD ><a href="#"Rel="nofollow"> My CV </a></dd> <dd><a href="#"> My favorite jobs </a></dd> <dd> <a id="Noticeno"href="#"> The position I posted <spanclass="Red DN"></span></a> </dd> &LT;DDclass="BTM"><a href="#"> My subscription </a></dd> <dd><a href="#"> I want to recruit </a></dd> <dd><a I D="accountsetting"href="#"> Account Settings </a></dd> <ddclass="Logout"><a href="#"Rel="nofollow"> Exit </a></dd> </dl><%}%>

In the proper location of the master page:
<%=html.partial ("Partial1")%>

MVC partial view (partial) displays changes before and after login and the shared folder does not appear in Solution Explorer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.