在mvc视图内部的部分视图 [英] partial view inside view in mvc
本文介绍了在mvc视图内部的部分视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个局部视图和视图,再次在视图中我需要局部视图。对于局部视图我在控制器中定义了动作并在视图中将其呈现为
I have one partial view and view and again in view i need partial view .for partial view i defined action in controller and rendered it in view as
@{Html.RenderAction("Edit", "Home");}
但是收到错误
but getting an error
Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.
推荐答案
阅读本文http://captaincodeman.com/2009/02/21/when-to-use-renderaction-vs-renderpartial-with -asp-net-mvc / [ ^ ]。它可能会有所帮助。
Read this http://captaincodeman.com/2009/02/21/when-to-use-renderaction-vs-renderpartial-with-asp-net-mvc/[^]. It may help.
嘿,
查看以下文章:
MVC中的部分视图
通过我的代码示例..工作原理
@ {Html.RenderAction(GetGoogleAnalyticCode) ,Home);}
Go thru my code for an example..it works
@{Html.RenderAction("GetGoogleAnalyticCode", "Home");}
public ActionResult GetGoogleAnalyticCode()
{
var settingvalue = (from s in _db.Settings
where s.SettingCode == "GA"
select s).FirstOrDefault();
return PartialView(settingvalue);
}
部分查看
@model BearBouquets。 Models.Setting
@ Html.Raw(HttpUtility.HtmlDecode(Model.SettingValue))
Partial View
@model BearBouquets.Models.Setting
@Html.Raw(HttpUtility.HtmlDecode(Model.SettingValue))
这篇关于在mvc视图内部的部分视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文