MVC4 mall project 3: Application of the branch view on the navigation bar, mvc4 Branch

Source: Internet
Author: User

MVC4 mall project 3: Application of the branch view on the navigation bar, mvc4 Branch

After writing for a few days, I found that I spent most of my time on JS. I wanted to write a musicstore, but added a framework. Then I wanted to use the background and then I wanted to use bootstrapt, then I want to design permissions, and then I want ............

It seems that I think too much ~

Well, we have set up the background recently. With metronic. bootstrap, it is really powerful. There are a lot of functions, so you can change it to save time costs. First look

 

Frame demo address: http://dreamsky.github.io/main/blog/metronic-bootstrap/index.html

: Http://dreamsky.github.io/main/blog/metronic-bootstrap/metronic.bootstrap.rar

From Sharing: Dream sky

 

To implement the navigation bar and menu bar functions, I used the segment view to understand it as a WEBFORM user control.

Let's take a look at the entity model:

 public class UrlConfigDto    {        public int Id { get; set; }        public string UrlName { get; set; }        public string Url { get; set; }        public int PageLev { get; set; }        public int LevOrder { get; set; }        public int UrlRole { get; set; }        public string Icon { get; set; }        public int POrder { get; set; }     }

  

I want to bind <URL, UNAME> to the view, so the List <string>

 public List<string> GetMeunTool(int orderId)        {            List<string> dic = new List<string>();          UrlConfig urlConfig=  _urlConfigRepository.GetFiltered(a => a.LevOrder == orderId).FirstOrDefault();            if (urlConfig==null)            {                return null;            }            dic.Add(urlConfig.UrlName+"^"+urlConfig.Url+"/"+urlConfig.LevOrder);            for (int i = 0; i < urlConfig.PageLev-1; i++)            {                UrlConfig tem = _urlConfigRepository.GetFiltered(a => a.LevOrder == urlConfig.POrder).FirstOrDefault();                dic.Add(tem.UrlName + "^" + tem.Url+ "/" + tem.LevOrder );                urlConfig.POrder = tem.LevOrder;            }            return dic;        }

Create a division view and pass the data model:

  public PartialViewResult MeunTool(int id)        {            return PartialView(_urlService.GetMeunTool(id));        }

To see the view page

@ Model List <string> @ if (Model = null) {

Actually, I want to use Dictionary <string, string> here, but it is not allowed in PartialView.

On the template page, we can call the Division view as follows:

  @{         int id = Convert.ToInt32(Html.ViewContext.RouteData.Values["id"]);         Html.RenderAction("MeunTool", "Admin", new { id = id });   }

 

Description of the design function of the id here. This ID is the unique key of the urlconfig table. I use it to identify the location of the current page, such as URL: http: // localhost: 11903/Admin/UserInfo/301

@ Html. ViewContext. RouteData. Values ["id"] The id parameter can be directly accepted on the view page.

 

PS: JS is the most time-consuming and a little time-consuming to use it as a project instead of a DEMO ......

For specific code implementation, see https://code.csdn.net/denghao156/ktnmb_mvc4

 


When creating an MVC4 project, select razor as the view and select "Basic" as the template. The problem occurs and cannot be created.


Reinstall NuGet. If not, reinstall VS2012.



Why is there no primary option in the navigation bar at the top of the page?

1. You cannot log on anonymously first.

2. If you are the first to get here, you should first post a post.

3. Maybe it's because the main location of the bar is full, so even if you apply, it's impossible to "squeeze" them down.

Or ...... Isn't it a fake website? (Well ...... It's okay to sweat Baidu ~)

Or else ...... Haven't you entered the post yet? Or is it wrong?

For example, you can enter the name of the Post Bar in the "know" field and search for it ......

Hmm ...... I am not very clear about myself. I hope you can understand it.

You can come to me and try it. Now there are two people.

Hmm ...... Not Asking You To apply ...... See if there is any blue navigation bar

If this item exists, it is what we say.

If not ...... That's terrible!

========================================================== ================

My post: Jing muyun

Post.baidu.com/f? Kw = % BE % B3 % A1 % A4 % C4 % BD % E4 % CE

You haven't paid attention to your questions for a long time ...... Points will be deducted soon after expiration

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.