위의 Duncan이 권고 한대로 JQuery UI Tabs을 사용하는 가장 좋은 프레임 워크는 충분히 재미 있습니다.
다음은 몇 가지 코드 samnples입니다.
<script type="text/javascript">
$(document).ready(function() {
$("#tabs").tabs();
getContentTab (1);
});
function getContentTab(index) {
var url='@Url.Content("~/SiteAdmin/AjaxGetTab")/' + index;
var targetDiv = "#tabs-" + index;
var ajaxLoading = "<img id='ajax-loader' src='@Url.Content("~/Content")/ajax-loader.gif' align='left' height='28' width='28'>";
$(targetDiv).html("<p>" + ajaxLoading + " Loading...</p>");
$.ajax({
type: 'get',
url: url,
cache: false,
success: function(result) {
$(targetDiv).html(result);
}
});
}
여기에 필요한 부분보기 팩을 전달 내 컨트롤러 액션 방법 :
보기는 jquery.tabs에 도청 JQuery와 스크립트() 기능이 있습니다.
/// <summary>
/// AJAX action method to obtain the correct Tab to use.
/// </summary>
/// <param name="index">Tab number</param>
/// <returns>Partial View</returns>
public ActionResult AjaxGetTab(int id)
{
string partialViewName = string.Empty;
object model = null;
//--Decide which view and model to pass back.
switch (id)
{
case 1:
partialViewName = "_TransactionType";
model = db.TransactionTypes.ToList();
break;
case 2:
partialViewName = "_DirectionType";
model = db.DirectionTypes.ToList();
break;
case 3:
partialViewName = "_UserType";
model = db.UserTypes.ToList();
break;
case 4:
partialViewName = "_CurrencyType";
model = db.CurrencyTypes.ToList();
break;
case 5:
partialViewName = "_tabError";
break;
}
return PartialView(partialViewName,model);
}
}
이렇게하면 여러 개의 탭을 실행하고 각 탭마다 필요한 데이터를 별도로 전달할 수 있습니다.
탭을위한 JQuery UI를 사용하면 탭을 깔끔하게 구현할 수 있습니다.
이 정보가 도움이 되나요? http://stackoverflow.com/questions/6420092/how-to-load-partial-views-with-jquery-ui-tab-by-passing-parameters 모든 사람이 .. 내 문제는 지금 – Anirban