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;
}

 

你可能感兴趣的:(asp.net)