当您使用Html.RenderPartial
is 时,将获取您要呈现的视图的名称,并在该位置呈现它的内容。
我想实现类似的东西。我希望它采用您要呈现的视图的名称以及其他一些变量,并在容器中呈现内容..
例如:
public static class WindowHelper
{
public static string Window(this HtmlHelper helper, string name, string viewName)
{
var sb = new StringBuilder();
sb.Append("<div id='" + name + "_Window' class='window'>");
//Add the contents of the partial view to the string builder.
sb.Append("</div>");
return sb.ToString();
}
}
有人知道怎么做吗?