• 追加された行はこの色です。
  • 削除された行はこの色です。
* 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



トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS