PartialViewResult用法

后台代码

        public PartialViewResult Title(int categoryid = 0)
        {

            IList<TestModel> lstTestModel = this.GetModelList(categoryid);

            return PartialView(lstTestModel);
        }


前端

<li>
    <div>
        <p>
            @foreach (TestModel tmItem in this.Model)
            {
                <a href="@tmItem.Url" target="_blank">@tmItem.Title</a><br />
            }</p>
    </div>
</li>

调用

@{Html.RenderAction("Title", new { categoryid = 1 });}
原文地址:https://www.cnblogs.com/booth/p/3240683.html