开发者

MVC 3 Shared Template Editor: Set default value for Create but not Edit

I would like to set the default value for an 'EditorFor' on my S开发者_开发知识库hared Template, but only on the Crate method and not the Edit method. How would I do this?

Thanks,


At the end of the day I decided this should be done in the controller, on my Create/Edit actions.


I'm not exactly sure how you can do this other than setting an EditorFor template and using EditorFor for the Create method, and TextboxFor on the Edit method (or vice versa).

You can still extend TextboxFor with custom CSS if needed, but it will probably not be quite as pretty as EditorFor.

Another option would be to build a TextboxFor razor template (if you're using MVC3 and Razor) and load it in as a @helper { } (still passing the model).
see Scott Gu's post on this one

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜