【发布时间】:2014-08-16 14:32:48
【问题描述】:
我想将 jQuery 对象(列表)传递给 MVC4 自定义 HTML Helper。
我的看法是这样的:
<script type="text/javascript">
$(document).ready(function () {
var datafilterList = GetDataFilter('@Url.Action("GetJsonDataFilter")'); // this is external file ajax call and I am getting the data pulled from controller. all ok here.
@Html.DataFilterFor(datafilterList) // how to pass datafilterList and call custom helper??
});
</script>
我的助手类:
public static class DataFilter
{
public static MvcHtmlString DataFilterFor(this HtmlHelper html, List<View_webpages_DataFilter> DataFilterList)
{
StringBuilder sb = new StringBuilder();
// TODO: Create the form and render html - I removed the unnecessary html code
return new MvcHtmlString(sb.ToString());
}
}
谁能告诉我如何将 jquery 对象 datafilterList 传递给 mvc 自定义助手?
谢谢
【问题讨论】:
标签: jquery asp.net-mvc-4 html-helper