prepopulate Html.TextBoxFor in asp.net mvc 3

前端 未结 2 715
耶瑟儿~
耶瑟儿~ 2020-12-30 14:03

I\'n new at this, so apologies if this isn\'t explanatory enough. I want to prepopulate a field in a form in asp.net mvc 3. This works;

@Html.TextBox(\"CompN         


        
2条回答
  •  旧时难觅i
    2020-12-30 14:55

    From your controller, if you pass a model initialized with default values using one of the View(...) method overloads that accepts a model object, these values will be used by the view when rendered. You won't need to use the @value = ... syntax.

提交回复
热议问题