MVCにはまだまだ新しいものがありますので、私にご負担ください。私はいくつかの動的に生成されたHTMLを取得しようとしています。この場合、私のnotifyList内の項目をリストします。私はコントローラー内のそれぞれをループし、データベースエントリーとして追加する予定です。どんな助けでも感謝しています。ビューからコントロールするHTMLアイテムを取得する
ビュー
@model _BaseViewModel
// The form it's within...
@using (Html.BeginForm("Create", "Leaf", FormMethod.Post, new { id = "createForm" }))
<div class="editor-label bottom-area bottom-header">
Notification List:
</div>
<div class="editor-field bottom-area">
<ul id="notifyList"></ul>
</div>
コントローラー:
[HttpPost]
public ActionResult Create(_BaseViewModel model)
{
// Some loop here
// get html here
db.UserItems.AddObject(model.user);
db.SaveChanges();
//
return RedirectToAction("Index");
}
アイテムはどのように生成されますか? ulには何が入っていますか?コントローラーで何を取りたいのですか? _BaseViewModelの外観はどうですか? –
ulには何も含まれていません。私はulにliを追加するためにJQueryを使用しています。私は李を取っておきたい。私のモデル、または少なくとも関係するもの: public Intra.Models.UserItem user {get;セット; } ありがとうございます。 – Ber53rker