使用jQuery TEMPL()我有一個模板如何使用MVC3
<script id="template" type="text/x-jquery-tmpl">
<div class="experience">
<label for="c${count}">New Thing:</label>
<input type="text" id="c${count}" name="Fund[${count}].Name" />
<label for="c${count}">New Thing count:</label>
<input type="text" id="c${count}" name="Fund[${count}].FundNo" />
</div>
到我動態控件添加到一個div容器。
我有一個模型在我的MVC應用程序
[Serializable]
public class Step2ViewModel : IStepViewModel
{
[Required]
public List<FormTest.Models.Item> Things;
}
[Serializable]
public class Item
{
public string Name { get; set; }
public string Number { get; set; }
}
如何綁定這些新創建的控件模型。這是否需要在我的模板中使用 @ Html.LabelFor,@ Html.TextBoxFor等?
謝謝!
編輯:
以防萬一的問題有不同的解釋 - 我要綁定動態創建的控件,當窗體發佈到列表在我的模型(這是用TEMPL()完成)。
請回去開始使用[JsRender](https://github.com/BorisMoore/jsrender)! – balexandre
必須有一個令人信服的理由來使用一個接近beta測試版的庫嗎? templ()有什麼問題? – MikeW
接近測試版?隊友,該項目(jQuert模板)完成!沒有更多的更新,故事的結尾。接近測試版的JsRender比jQuery模板和我自己更強大,許多人在生產中使用它。 – balexandre