- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- バックアップ を表示
- dotNet-ASP.NET MVC/Razor/TextBoxForにデフォルト値を設定する へ行く。
- 1 (2014-02-22 (土) 20:29:42)
* Razor - TextBoxForにデフォルト値を設定する [#u70d8c0d] *** Controller [#a9f4e87d] public ActionResult Index() { //here you must set VALUE what u want, //for example I set current date Viewbag.ExactlyWhatYouNeed = DateTime.Now return View(); } *** View [#pcb1fa8c] @Html.TextBoxFor(model => model.CurrentDate, new { @Value = ViewBag.ExactlyWhatYouNeed}) ** 参考 [#j176cea2] http://stackoverflow.com/questions/16625460/how-to-set-default-value-html-textboxfor