我是靠谱客的博主 无心路灯,这篇文章主要介绍html.renderpartial 命名空间,Html.RenderPartial的三个参数的用法 用法实例,现在分享给大家,希望可以做个参考。

后台代码:

ViewBag.smallCategory = categoryService.LoadEntities(m=>m.ParentID==(short)Model.Enum.CategoryEnum.ProductTrade);

ViewData["Total"] = classInfoService.LoadEntities(m => m.Category.ParentID == (short)Model.Enum.CategoryEnum.ProductTrade).ToList().Count;

前台代码:

@{

var data = new ViewDataDictionary();

data.Add("total", ViewData["Total"]);

Html.RenderPartial("../Category/SmallCategory", ViewBag.smallCategory as IEnumerable, data);

}

绑定的页面代码:

@model IEnumerable

@{

Layout = null;

}

 @Html.ViewData["total"] 条信息

  • 所有分类
  • 全部

@foreach (var item in Model)

{

@item.CName

}

最后

以上就是无心路灯最近收集整理的关于html.renderpartial 命名空间,Html.RenderPartial的三个参数的用法 用法实例的全部内容,更多相关html.renderpartial内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(87)

评论列表共有 0 条评论

立即
投稿
返回
顶部