2013-02-26 52 views
0

我需要在jqGrid中發送一個或兩個額外的參數給我的url方法。有沒有辦法做到這一點?在jqGrid url選項中發送其他參數

$(document).ready(function() { 
     jQuery("#frTable").jqGrid ({ 
      cmTemplate: { sortable: false }, 
      caption: '@TempData["POPNAME"]' + ' Population', 
      url: '/Encounters/GetAjaxPagedGridData/'+ @TempData["POPULATIONID"]+'', 
      ... 

這將是我試圖打的方法...

public string GetAjaxPagedGridData(int page, int rows, int popId) { 
     return ""; 
    } 

我想是這樣,例如該

url: '@Url.Action("GetAjaxPagedGridData", "Encounters", new { popId = TempData["POPULATIONID"] })' 

回答

0

後期使用數據選項執行以下操作:

$(document).ready(function() { 
    jQuery("#frTable").jqGrid ({ 
     cmTemplate: { sortable: false }, 
     caption: '@TempData["POPNAME"]' + ' Population', 
     url: '/Encounters/GetAjaxPagedGridData/', 
     postdata: {popId : TempData["POPULATIONID"], 
        // and any other parameters that you need to pass} 
+0

我還可以使用mtype o f'GET' – SoftwareSavant 2013-02-26 20:16:51

+0

是'GET'的mtype很好 – CharlesMighty 2013-02-26 20:24:38

+0

我不知道。我的方式似乎更好。 – SoftwareSavant 2013-02-26 20:27:21