title: Calling Controller Class and passing value
body: <p>I am trying to create a menu using <code>&lt;ui&gt;&lt;li&gt;&lt;/li&gt;&lt;/ui&gt;</code> tags. I am reading from an XML file and storing it in a List of(menu) object.</p>
  
  <p><strong><em>Menu Object:</em></strong></p>
  
  <pre><code>Public Class MenuVM
  
  #Region "Properties"
      Public Property ID As Integer
      Public Property Description As String
      Public Property Comments As String
      Public Property UserControlName As String
      Public Property AssemblyName As String
      Public Property ModelName As String
      Public Property SortOrder As Integer
      Public Property IsSelected As Boolean
  #End Region
  
  End Class
  </code></pre>
  
  <p><strong><em>HomeController Class:</em></strong></p>
  
  <pre><code>    Public Class HomeController
      Inherits System.Web.Mvc.Controller
  
  
      Function Index() As ActionResult
          Dim oMenuHelper As New MenuHelper
          Return View("index", oMenuHelper.BuildMenu())
      End Function
  
      &lt;HttpPost()&gt; _
      Function Index(ByVal iSelect As Integer) As ActionResult
          Dim oMenuHelper As New MenuHelper
          Return View("index", oMenuHelper.BuildMenu())
      End Function
  
      Function About() As ActionResult
          Return View()
      End Function
  End Class
  </code></pre>
  
  <p><strong><em>ASPX PAGE:</em></strong></p>
  
  <pre><code>&lt;%@ Page Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage(Of List(OF MVCApp.MenuVM))" %&gt;
  &lt;%@ Import Namespace ="MVCApp" %&gt;
  &lt;asp:Content ID="indexTitle" ContentPlaceHolderID="TitleContent" runat="server"&gt;
      Home Page
  &lt;/asp:Content&gt;
  
  &lt;asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server"&gt;
  
      &lt;div id="menu" class="block"&gt; 
      &lt;% Using Html.BeginForm("Index", "Home")%&gt;  
        &lt;ul id="menuItems"&gt; 
  
          &lt;% For Each item As MVCApp.MenuVM In Model%&gt;
           &lt;li&gt;&lt;%: Html.ActionLink(item.Description, "Index", "Home", New With {item.ID}, Nothing)%&gt;&lt;/li&gt;               
          &lt;%Next%&gt;
         &lt;/ul&gt; 
          &lt;% End Using %&gt;              
  
  &lt;/div&gt; 
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>The output:</p>
  
  <p><img src="https://i.stack.imgur.com/1iKaF.jpg" alt="enter image description here"></p>
  
  <p>When You click on view source the output is as follow:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;&lt;title&gt;
  
      Home Page
  
  &lt;/title&gt;&lt;link href="Content/Site.css" rel="stylesheet" type="text/css" /&gt;
      &lt;script src="/Scripts/jquery-1.5.1.min.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div class="page"&gt;
          &lt;div id="header"&gt;
              &lt;div id="title"&gt;
                  &lt;h1&gt;My MVC Application&lt;/h1&gt;
              &lt;/div&gt;
              &lt;div id="logindisplay"&gt;
  
  
          [ &lt;a href="/Account/LogOn"&gt;Log On&lt;/a&gt; ]
  
              &lt;/div&gt; 
              &lt;div id="menucontainer"&gt;
                  &lt;ul id="menu"&gt;
                      &lt;li&gt;&lt;a href="/"&gt;Home&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a href="/Home/About"&gt;About&lt;/a&gt;&lt;/li&gt;
                  &lt;/ul&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div id="main"&gt;
  
  
      &lt;div id="menu" class="block"&gt; 
      &lt;form action="/" method="post"&gt;  
        &lt;ul id="menuItems"&gt; 
  
  
           &lt;li&gt;&lt;a href="/Home/Index/1"&gt;Ballot Language&lt;/a&gt;&lt;/li&gt;               
  
           &lt;li&gt;&lt;a href="/Home/Index/2"&gt;Assisting Absentee Voter&lt;/a&gt;&lt;/li&gt;               
  
           &lt;li&gt;&lt;a href="/Home/Index/3"&gt;Instructions&lt;/a&gt;&lt;/li&gt;               
  
           &lt;li&gt;&lt;a href="/Home/Index/4"&gt;Ballot Questions&lt;/a&gt;&lt;/li&gt;               
  
         &lt;/ul&gt; 
          &lt;/form&gt;              
  
  &lt;/div&gt; 
  
              &lt;div id="footer"&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>ERROR: When I Click on the link I am getting following error:</p>
  
  <p><img src="https://i.stack.imgur.com/BQ8TG.jpg" alt="enter image description here"></p>
  
  <p>Could any one help with it. My intension is to pass menu id to controller and load appropriate usercontrol. I cannot use Javascript or jquery in this project as user might have javascript disabled on machine.</p>