使用Razor View引擎從部分視圖ASP.NETMVC 3中將內(nèi)容注入特定部分我在我的_Layout.cshtml@RenderSection("Scripts", false)我可以很容易地從一個(gè)角度來(lái)使用它:@section Scripts {
@*Stuff comes here*@}我正在掙扎的是如何從部分視圖中將一些內(nèi)容注入到本節(jié)中。讓我們假設(shè)這是我的視圖頁(yè)面:@section Scripts {
<script>
//code comes here
</script>}<div>
poo bar poo</div><div>
@Html.Partial("_myPartial")</div>我需要在Scripts一節(jié)_myPartial部分視圖。我該怎么做?
3 回答

德瑪西亞99
TA貢獻(xiàn)1770條經(jīng)驗(yàn) 獲得超3個(gè)贊
_layout
@RenderSection("body_scripts", false)
index
@Html.Partial("Clients")@section body_scripts{ @Html.Partial("Clients_Scripts")}
clients
@section body_scripts{ @Html.Partial("Clients_Scripts")}
Clients_Scripts
body_scripts
- 3 回答
- 0 關(guān)注
- 589 瀏覽
添加回答
舉報(bào)
0/150
提交
取消