我使用的DevExpress v10.2.3分組GridView控件與asp.net的MVC 4.我可以從數據庫中獲取DATAS,並告訴他們。但我不能改變螞蟻的約束,例如:按列排序。當我點擊排序我獲得以下彈出page.This頁面打開時我每按一下火腳本。對此有何想法?可能這是一個容易的錯誤,但我無法看到它。的DevExpress GridView的gruping?
謝謝。
partialView
@Html.DevExpress().GridView(
settings =>
{
settings.Name = "gvGrouping";
settings.CallbackRouteValues = new { Controller = "Customer", Action = "PartialCustomers" };
settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
settings.Columns.Add("sno");
settings.Columns.Add("Name");
settings.Columns.Add("City");
settings.Columns.Add("Ilce");
settings.Columns.Add("Sokak").GroupIndex = 0;
settings.Settings.ShowGroupPanel = true;
settings.CustomCallback = (sender, e) =>
{
int layoutIndex = Int32.Parse(e.Parameters);
DevExpress.Web.Mvc.MVCxGridView grid = (DevExpress.Web.Mvc.MVCxGridView)sender;
grid.BeginUpdate();
try
{
grid.ClearSort();
switch (layoutIndex)
{
case 0:
grid.GroupBy(grid.Columns["Sokak"]);
break;
case 1:
grid.GroupBy(grid.Columns["Sokak"]);
grid.GroupBy(grid.Columns["City"]);
break;
case 2:
grid.GroupBy(grid.Columns["Name"]);
break;
}
}
finally
{
grid.EndUpdate();
}
grid.ExpandAll();
};
}).Bind(Model).GetHtml()
查看
@model IEnumerable<mvc4devex.Models.Customers>
@{
ViewBag.Title = "Customers";
}
<label for="GroupBy">GroupBy:</label>
<select id="GroupBy" onchange="gvGrouping.PerformCallback(this.value);">
<option value="0">Sokak</option>
<option value="1">Sokak, City</option>
<option value="2">Name</option>
</select>
<input type="button" value="Collapse All Rows" onclick="gvGrouping.CollapseAll();" />
<input type="button" value="Expand All Rows" onclick="gvGrouping.ExpandAll();" />
<br /><br />
@Html.Partial("_PartialCustomers", Model)
settings.CallbackRouteValues = new {Controller =「Customer」,Action =「PartialCustomers」}; PartialCustomers是否返回PartialView? (它應該非常簡單,只是是你用你的指標相同梅索德) –
我解決它感謝關注。我用局部視角。我改變了它。非常感謝。 –
這是愚蠢的錯誤:) –