現在、テーブル行から選択したレコードを取得するコントローラには、多数のメソッドがあります。ASP.NET MVCがjQueryのコントローラパラメータにマッピングオブジェクト配列を渡します。
だから私は
var ids = [];
var prices = [];
var customers = [];
$selectedRow.each(function() {
ids.push($(this).find('.id').text());
prices.push($(this).find('.price').text());
customers.push($(this).find('.customer').text());
});
$.post(....) // AJAX call to controller method
のようなものがあるかもしれませんし、コントローラに、私はイテレータを使用して対処するだけで少し厄介です
public ActionResult DoSomething(int[] ids, double[] prices, string[] customers) { ... }
で終わります。私が本当に欲しいこと
Class Foo
{
int id;
double price;
string customer;
}
を持っており、
public ActionResult DoSomething(List<Foo> foos) { ... }
を受け取ることができるようにすることです
が可能である。この?
ハックポストが面白そうに見える、私はそれをチェックします。 – fearofawhackplanet