asp.net MVC中的菜单链接 [英] Menu Link in asp.net MVC

查看:73
本文介绍了asp.net MVC中的菜单链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我正在使用mvc2 c#asp.net创建一个网站,因为我已经创建了一个菜单。现在我想通过将它连接到控制器来连接它。视图。

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.

<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>







我尝试过传统的菜单链接,但它不值得这个mvc框架。所以我只是谷歌搜索它,大多数人都说动态菜单更新和所有..也不是一个可以理解的形式。所以我如何实现这个?




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?

推荐答案

As我知道,你真的在​​开始。 MVC不是WebForms。

我建议你开始一个教程。官方的非常好: http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/intro-to-aspnet-mvc-4 [ ^ ]。我还建议您只需在Visual Studio中打开模板并研究生成的代码。



请注意,您的问题的答案取决于其余的ASP.NET MVC平台,因此它不会帮助你自己。但是你有这个:使用 Html.ActionLink [ ^ ]方法。考虑到您在应用程序中使用的路由,它将与控制器中的操作建立正确的链接。
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.


这篇关于asp.net MVC中的菜单链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆