2015-10-19 36 views
2
页面

我有两个方法HTTPGET作为 公众的ActionResult MiReport(){ 回报 视图(); }分页不工作在GridMvc其重装

和httppost作为

public ActionResult GetReportView(string startdate,string enddate) { 
    ReportModel Obj = new ReportModel(startdate, enddate); 
    return PartialView("GetReportView",Obj); 
} 

我绑定网格,

@using GridMvc.Html 
<div class="col-md-12"> 
<h4><strong>REPORT</strong></h4> 
@Html.Grid(Model.lstReport).Columns(columns => { 
    columns.Add(c => c.rep).Titled("REP"); 
    columns.Add(c => c.businessName).Titled("BUSINESS NAME"); 
    columns.Add(c => c.contactNmae).Titled("CONTACT NAME"); 
}).WithPaging(10) 
</div> 

我展示它查看其装载第10行罚款,但,当我点击呼叫按钮,其调用Get方法并且页面正在被重新编码。 请帮帮我。 在此先感谢。

回答

0

你需要让你的网格被赋予这样一个名称(Index.cshtml):当你点击

public ActionResult Index(String grid1 = "") 

现在:

.WithPaging(10, 10, "grid1") 

现在在指数的方法将其更改为在网页中,您将在网址中看到页码为grid1 = 3,这会读入Index方法的参数grid1。

现在,在这个方法检查: -

if (!String.IsNullOrEmpty(grid1)) 
{ 
//my grid was populated based on PersonnelId selected in some dropdown on the view.You can use the variable in which you stored your key. 
id = TempData["TimeOffPersonnelID"].ToString(); 
} 

希望这有助于!