要回答我的問題:
我結束了使用PartialViews和jQuery。
單擊一行中的選擇鏈接會導致在選定的行之下添加一個新行(使用jQuery)。進入這一行,我使用jQuery GET/PurchaseOrder/Detail(PartialView)。
這裏是我的javascript:
function GetDetails(id, enableEdit) {
var detailsRowExists = $().find("#detailsRow").size();
if (detailsRowExists) {
// Delete details row
// Note: need to rename id for row to be deleted
// because jQuery does not wait for the row to be
// deleted before adding the new row.
$("#detailsRow").attr("id", "detailsRowOld");
$("#detail").slideUp("normal", function() {
$("#detailsRowOld").remove();
});
};
// Put new row below selected one
$("tr[id=" + id + "]").after("<tr id='detailsRow'><td colspan='4'><div id='detail'><img src='../../Content/wait20trans.gif' />Loading...</div></td></tr>");
// Pull details into new row
$.get("/PurchaseOrder/Detail/" + id, { enableEdit: enableEdit },
function(data) {
$("#detail").hide();
$("#detail").html(data);
$("#detail").slideDown("normal");
}
);
}
希望這5幫助別人試圖實現一個主/詳細信息頁面。