albert albert

albert albert

  • NA
  • 524
  • 0

How to create a dropdown mennu with ASP.NET MVC 3

Apr 3 2012 11:16 AM
I am trying to create a dropdown menu with ASP.NET MVC 3.

I have all the classes. But How I call a CSS class??

this is my hole project. I already have the parent menus. But how to manage to child menus under the parent menu?

I realy hope somebody can help me.

I have this:
_Layout.cshtml
[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 3.0 License

Name  : Reinstated
Description: A two-column, fixed-width design with dark color scheme.
Version  : 1.0
Released  : 20120326
-->
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <title>@ViewBag.Title</title>
    <link href="http://fonts.googleapis.com/css?family=Oswald" rel="stylesheet" type="text/css" />
     <link href="@Url.Content("~/Content/WinituLayout/style.css")" rel="stylesheet" type="text/css" />
     <script src="@Url.Content("~/Content/WinituLayout/init.js")" type="text/javascript"></script>
  <script src="@Url.Content("~/Content/WinituLayout/jquery-1.7.1.min.js")" type="text/javascript"></script>
  <script src="@Url.Content("~/Content/WinituLayout/jquery.dropotron-1.0.js")" type="text/javascript"></script>
   
  </head>
  <body>
    <div id="wrapper">
      <div id="splash">
        <img src= "Content/WinituLayout/images/pic1.jpg" alt="" />
      </div>
      <div id="menu">
        <ul>
      <li>@Html.ActionLink("Home", "Index", "Home")</li> 
  <li>@Html.ActionLink("Beheer", "Index", "Home")</li> 
  <li>@Html.ActionLink("Uren", "Index", "Home")</li>
  <ul>
  <li> @Html.ActionLink("Home", "Index",new{id=1},  new{@class = "first"})</li>
              <li><a href="#">Libero felis dolor</a></li>
  <li>@Html.DropDownList("PriorityID", new List<SelectListItem>(), new {@class="first"} )</li>
  <li>@Html.me</li>
  </ul>
    </ul>
      </div>
      <div id="header">
        <div id="logo">
          <h1><a href="#">Winitu uren beheer systeem</a></h1>
        </div>
        <div id="search">
          <form action="" method="post">
            <div>
              <input class="form-text" name="search" size="32" maxlength="64" />
            </div>
          </form>
        </div>
      </div>
      <div id="page">
        <div id="content">
  @RenderBody()
         
        </div>
        <div id="sidebar">
         
        </div>
        <br class="clearfix" />
      </div>
    </div>
    <div id="footer">
      &copy; </a>.
    </div>
  </body>
</html>
[/code]

And I have added also the hole project. If u donwload the project u see 3 menu items: Home, Beheer and Uren. I just want under Uren 2 more itmes, like a dropdown box. The css classe:class="first" is responsible for this. But How to call that class in MVC?? I am using the Razor view Engine. AND i surfed the internet for hours. But I dont see any examples. I only see examples with simple navigation structure. But now dropdown menu navigation. I realy dont understand where there is so less information about.
Here is a link what I mean: http://www.freecsstemplates.org/preview/reinstated/

THX