在MVC2中的服务器端(c#)中渲染局部视图 [英] Rendering partial view in server side(c#) in MVC2
本文介绍了在MVC2中的服务器端(c#)中渲染局部视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在asp.net mvc 2中使用Html.DisplayFor/Html.EditorFor表达式呈现部分视图.
现在,我已经使用Html.partial进行渲染.但是我需要使用显示/编辑器表达式进行渲染
How to render the partial view using Html.DisplayFor/Html.EditorFor expression in asp.net mvc 2.
Now i have rendered using Html.partial. But i need to render using display/editor expression
推荐答案
hi,
只需添加html helper方法
Html.RenderPartial(指定路径)
下面是一个示例...
希望这对您有帮助
<%Html.RenderPartial(〜/Views/UserControls/LogOnLogOff.ascx"); %>
just add the html helper method
Html.RenderPartial(specify the path)
one example is below...
hope this may help you
<%Html.RenderPartial("~/Views/UserControls/LogOnLogOff.ascx"); %>
您也可以使用jQuery执行此操作.
Hi,
You can also perform this by using jQuery.
<script type="text/javascript">
function loadPartial() {
var name =
(#selectPartial").val();
("#selectPartial").val();
这篇关于在MVC2中的服务器端(c#)中渲染局部视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文