The mvc part view (Partial) displays the changes before and after login and the Shared folder is not displayed in solution Resource Manager,

Source: Internet
Author: User

The mvc part view (Partial) displays the changes before and after login and the Shared folder is not displayed in solution Resource Manager,

At the beginning, my Solution Explorer did not display the Shared folder, but the Shared folder actually exists in the project, I searched for a keyword that seems to be inaccurate ). Later, I read vs2012.

In fact, the solution is very simple:

First, view-solution Resource Manager. In Solution Explorer, click "show all files" in the red box ".

Then a file similar to the image appears. Find the file you want, right-click it, and click "include in Project" in the red box.

 

The mvc branch view displays changes before and after logon.

The effect is as follows:

Before Logon :;

After login:

First, right-click the Shared folder and add the view: (for example)

In the segment View:

 

<% @ Control Language = "C #" Inherits = "System. web. mvc. viewUserControl "%> <% if (Session [" NICKNAME "] = null) {%> <ul class = "loginTop"> <li> <a href = "<% = Url. action ("Login", "Account ") %> "rel =" nofollow "> logon </a> </li> <li >|</li> <a href =" <% = Url. action ("Register", "Account ") %> "rel =" nofollow "> Registration </a> </li> </ul> <%} else {%> <dl class =" collapsible_menu "> <dt> <span id = "nowrap"> <% = Session ["NICKNAME"] %> </span> <span id = "noticeDot" class = "red dn"> </span> <I> </dt> <dd> <a href = "#" rel = "nofollow"> my resume </a> </dd> <dd> <a href = "#"> my favorite positions </a> </dd> <a id = "noticeNo" href = "#"> my shipping <span class = "red dn"> </span> </a> </dd> <dd class = "btm"> <a href = "#"> me </a> </dd> <a href = "#"> I want to recruit </a> </dd> <a id =" accountSetting "href =" # "> account settings </a> </dd> <dd class =" logout "> <a href =" # "rel =" nofollow "> exit </a> </dd> </dl> <%} %>

 

The proper location on the master page:
<%=Html.Partial("Partial1") %>

 

 

 

Related Article

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.