2011-03-15 3 views
1

mvc3 webgrid에 json 페이징 샘플이 있습니까?누구나 mvc3 webgrid의 json 페이징 샘플을 가지고 있습니까?

나는 이것들을 찾기 위해 몇 시간 동안 웹 사이트를 트롤링 해왔고이 링크는 다음과 같습니다. Efficient Paging with WebGrid Web Helper - ASP.NET MVC 3 RC 컨트롤러에 html을 쓰는 것에 대한 확신이 없습니다. 편집/삭제 링크를 생성하는 구문에 대한 권리를 얻으십시오.

건배!

답변

3

그래서 대부분의 예제가 크게 복잡해졌습니다. 좋은 예 그것은 키가 내 경우에는 grid는 해당 부동산 ajaxUpdateContainerId에 밝혀 here

찾을 수 있습니다.

이것은 전체 페이지를 자동으로 새로 고치지 않고도 작동하도록 그리드를 연결합니다.

나는 적절한 구문을 제공하기 위해 노력하고있는 일부 코드를 게시했습니다.

@{ 

    WebGrid webGrid = new WebGrid(canSort: false, canPage: true, rowsPerPage: 5, ajaxUpdateContainerId: "grid"); 
    webGrid.Bind(Model, autoSortAndPage: false, rowCount: Model.TotalItemCount); 

} 

<div id="grid"> 
    @webGrid.GetHtml(alternatingRowStyle: "altrow", 
       mode: WebGridPagerModes.All, 
       firstText: "<< first", 
       previousText: "< previous", 
       nextText: "next >", 
       lastText: "last >>", 
       columns: webGrid.Columns(
       webGrid.Column("Name"), 
       webGrid.Column("State.Name", "State"), 
       webGrid.Column(header: "", 
           style: "action", 
           format: (item) => new HtmlString(Html.ActionLink("edit", "Edit", new { id = item.CityId }).ToString() + " | " + 
                   Html.ActionLink("delete", "Delete", new { id = item.CityId }).ToString() 
                   )))) 
</div> 
관련 문제