<div class="head">
@{Html.RenderAction("Top_Head", "My_PartialView");}
</div>
<div class="content">
<div class="content-left">
<div class="ad">
<img src="~/Images/ImageFontEnd/ad.jpg" />
</div>
@RenderBody()
</div><!--END Content-left-->
<div class="content-right">
<div class="##-lhe-support-login-sp" id="lien-he">
<div class="label-238px-box"></div>
<img src="~/Images/ImageFontEnd/call-pic.jpg" />
</div>
@{Html.RenderAction("Search_Price", "My_PartialView");}
2.创建My_Partialview
using System;
namespace shopclothes.Controllers
{
public class My_PartialviewController : Controller
{
shoponline1Entities db = new shoponline1Entities();
// GET: /MyPartialView/
#region[head]
[ChildActionOnly]
public ActionResult Top_Head()
{
return PartialView();
}
#endregion
}
}
我遵循正确的语法?为什么会出现这样的问题?
答案 0 :(得分:0)
@RenderBody
应该在布局视图上使用,请尝试删除
答案 1 :(得分:0)
错误: @ {Html.RenderAction(&#34; Top_Head&#34;,&#34; My_PartialView&#34;);} 和 @ {Html.RenderAction(&#34; Search_Price&#34;,&#34; My_PartialView&#34;);}
答案 2 :(得分:0)
在布局中同时使用@ html.RenderAction或@ html.Action似乎有一个错误。我建议您以其他方式尝试使用等效的renderaction命令。要获得更多帮助,您可以查看{{3 }}