ASP.NET MVC PartialView用法

子页面AreaSelect.cshtml页面的Controller代码:

public ActionResult AreaSelect()
{
    return PartialView();
}

父页面前台代码:

<td>
    @{ 
        ViewDataDictionary data = new ViewDataDictionary();
        data.Add("areaId", "2");
        Html.RenderPartial(Url.Content("~/Views/Backstage/Area/AreaSelect.cshtml"), null, data);
    }
</td>

子页面前台获取父页面传入的参数:

@{
     string areaId = ViewBag.areaId;
}

 

posted @ 2014-12-26 10:08  0611163  阅读(672)  评论(0编辑  收藏  举报