1
我有一個視圖,我加載其中的局部視圖,我想刷新視圖上的一個div而不加載整個視圖。我的代碼:加載或刷新僅使用Ajax的局部視圖
<div id="newrealeaseform">
<div id="newrealeaseformplayer">
@* @Html.Action("MusicPlayer", "NewRelease")*@
</div>
`@Html.Partial("_MusicPlayer")`
`@using (Ajax.BeginForm("Index", new AjaxOptions { `
`hereHttpMethod="GET",`
` InsertionMode = InsertionMode.Replace,
UpdateTargetId = "albumlist"
}))
{
<div id="newrealeaseformcontent">
<h2>New Releases(@Model.Genre)</h2>
<div id="daterangesearchcntrl">
@Html.HiddenFor(m => m.Genre)
@Html.Label("choose release date")
@Html.TextBoxFor(m => m.DateRange, new { @readonly = "readonly", @id = "daterange" })
<input class="sb_search" type="submit" value=""/>
</div>
<br />
<br />
<br />
<div id="albumlist">
<ul id="newreleasealbum-list">
@foreach (var album in Model.Albums)
{
<li style="margin-left:0px;padding-left:0px">
<a href="@Url.Action("AlbumPopup", new { id = album.AlbumId })" class="openPlayer">
<img alt="@album.Title" width="75" height="74" src="@album.AlbumPhoto.ThumbnailPath" />
<div class="clear"></div>
</a>
</li>
}
</ul>
<div class="clear"></div>
</div>
</div>
}
</div> `
我要刷新 「albumlist」 分區,而不對這一觀點重裝Html.Partial( 「_ MusicPlayer」)。請幫忙。提前
感謝