私は、複数のMvcContribグリッドを並べ替える構文を理解できません。私はJeremy Skinnerの勧告がhereであることを知っていますが、Bind属性を使用することですが、それを正しく取得できません。私は私は本当にバインド属性についてのすべてを理解していないと思い複数のMvcContribグリッドをソートするコントローラの構文は何ですか?
public ActionResult Index([Bind](Prefix="grid1")GridSortOptions sort)\\how do I reference the prefix of my second grid?
{
ViewData["sort"] = sort;
var products = _productService.GetAllProducts();
var categories = _categoryService.GetAllCategories();
//Here is where I am stuck
if(sort.Column != null)
{
products = products.OrderBy(sort.Column, sort.Direction);
//how do I reference the sort columns of my second grid?
}
var model = new ContainerModel
{
Products = products,
Categories = categories
};
return View(model);
}
:
は、ここに私のコントローラです。 2番目のGridSortOptions引数を追加しようとしましたが、成功しませんでした。
これは私の見解です。
.Sort((GridSortOptions)ViewData["sort"], "grid1")//Grid 1
.Sort((GridSortOptions)ViewData["sort"], "grid2")//Grid 2
ありがとう。
これで運がいいですか?私も同様の不具合を抱えています。 –