当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - WebGrid Sorting on partial strips all styles and scripts from view

问题描述:

I'm using MVC 5 and I have a view which contains a partialview. The partial view contains the grid I'm displaying data in. This data is loaded in using jquery. Once I try and sort any column only the partial view is being rendered with the appropriate sort. This partial is without any styles or javascript, since it is on the parent pages.

Here is my grid:

@grid.GetHtml(tableStyle: "table table-striped table-bordered",

headerStyle: "thead-default",

columns: grid.Columns(

grid.Column("account_number", "Account Number", canSort: true),

grid.Column("last_name", "Last Name", canSort: true),

grid.Column("first_name", "First Name", canSort: true),

grid.Column("middle_name", "Middle Name", canSort: true),

grid.Column("reject_reviewed", "Reviewed", canSort: true, format: (item) => Html.CheckBox("completed", (bool)(item.reject_reviewed == 1), new { disabled = "disabled" })),

grid.Column("comment", "Comments", format: (item) =>

new HtmlString(

Html.ActionLink("Add", "RejectAddComment", controller, new RejectCommentViewModel { reject_id = item.id, account_number = item.account_number, reject_message = item.reject_message },

htmlAttributes: new { data_modal = "", id = "btnCreate", @class = "" }).ToString()

+ " | " +

Html.ActionLink("View", "RejectViewComment", controller, new RejectCommentViewModel { reject_id = item.id, account_number = item.account_number, reject_message = item.reject_message },

htmlAttributes: new { data_modal = "", id = "btnCreate", @class = "" }).ToString())),

grid.Column("reject_message", "Reject Message", canSort: true)))

This is all in its own partial.

分享给朋友:
您可能感兴趣的文章:
随机阅读: