Click here to Skip to main content
15,867,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello i am creating a website using mvc2 c# asp.net,in that i have created a menu.Now i want to connect it with view .how to connect it by passing it to the controller.
C#
<td class="style2" valign="top">
             <table style="width: 100%; height: 100%">
                 <tr>
                     <td class="style4" valign="top">
                         <div class="urbangreymenu">
                             <h3  runat="server" id="a4" class="headerbar">
                                 DashBoard</h3>
                             <ul>
                                 <li  runat="server" id="a1"><a href="">My Accounts</a></li>
                                 <li  runat="server" id="a3"><a href="#">My System Settings</a></li>
                             </ul>
                             <h3  runat="server" id="a5" class="headerbar">
                                 Control Panel</h3>
                             <ul>
                                 <li  runat="server" id="a6"><a href="../Admin/Index.aspx">Student Management</a></li>
                                 <li  runat="server" id="a7"><a href="#">Tutor Management</a></li>
                             </ul>
                         </div>
                     </td>



I have tried with conventional menu linking but its not worth for this mvc framework.So i just googled it ,most of them says about dynamic menu update and all ..its also not in an understandable form.So how i implement this?
Posted
Comments
Zoltán Zörgő 31-Oct-13 14:40pm    
The key sentence:
"Now i want to connect it with view .how to connect it by passing it to the controller."
makes no sense. Please clarify!

PS: forget MVC2... use MVC4
Member 10370658 31-Oct-13 14:44pm    
Hello
When we click a menu Say "Dashboard" it will show the dashboard page.For that we can use href="dashboard.aspx" .like this how we use it in mvc?How the controller will handle the request

1 solution

As I see, you are really at the beginning. MVC is not WebForms.
I suggest you start a tutorial. The official ones are really good: http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/intro-to-aspnet-mvc-4[^]. I also suggest you simply open the template in Visual Studio and study the generated code too.

Please note, that the answer to your question is dependent on the rest of the ASP.NET MVC platform, thus it won't help you on it's own. But here you have it: use Html.ActionLink[^] method in the view. It will make the correct link to the action in the controller, taking into account the routing you have used in your application.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900