问题描述
嗨朋友们,
我有一个< href>我的.cshtml页面中的属性mvc4
我的mvc 4中的
....我需要的是如果有人点击上面的链接。我必须将他重定向到Controller中的任何ActionName(例如:HomeController中的Index)......如何做到这一点。在上面的示例中,我已重定向到google.com ......但我需要重定向到控制器中的任何actionname ......
我的代码:
@ {
List< menurazor.models .menuitem> menulist = ViewBag.Menu;
}
-
@if(menulist.Count(p => p.ParentMenu_Id == mp.Id)> ; 0)
{
@:-
@mp.Name
@if (menulist.Count(p => p.ParentMenu_Id == mp.Id) > 0)
{
@:
}
@RenderMenuItem(menulist, mp)
@if (menulist.Count(p => p.ParentMenu_Id == mp.Id) > 0)
{
@:
}
@RenderMenuItem(menuList,cp)
if(menuList.Count(p => p.ParentMenu_Id == cp) .Id)> 0)
{
@:
}
@RenderMenuItem(menuList, cp)
if (menuList.Count(p => p.ParentMenu_Id == cp.Id) > 0)
{
@:推荐答案
@Html.ActionLink( "Reply", // linkText "ReplyCommentAdd", // actionName "Comment", // routeValues new { // htmlAttributes PostId = PostId, } )
这篇关于mvc4中的href属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
}
@RenderMenuItem(menulist,mp)
@if(menulist.Count(p => p.ParentMenu_Id == mp.Id)> 0)
{
@:Hi Friends,
I am having a < href > attributes in my .cshtml page at mvc4 @cp.Name
in my mvc 4 .... what i need is if a person clicks the above link . i have to redirect him to any of the ActionName in Controller (for eg: Index in HomeController )...... how to do it. In my above sample i have redirected to google.com...... but i need to redirect to any of actionname in controller......
My code:
@{
List<menurazor.models.menuitem> menulist = ViewBag.Menu;
}
@foreach (var mp in menulist.Where(p => p.ParentMenu_Id == 0))
{
-
@foreach( menulist.Vhere(p => p.ParentMenu_Id == 0))
{