开发者

Asp.Net MVC Custom ModelBinder

开发者 https://www.devze.com 2023-01-21 07:11 出处:网络
I would like to bind a complex object to a view. I create a custom ModelBinder inherited from DefaultModelBinder so if I post the form I can reach proper data in Controller.

I would like to bind a complex object to a view.

I create a custom ModelBinder inherited from DefaultModelBinder so if I post the form I can reach proper data in Controller.

But if I want to send data to the view the data will not be binded.

开发者_StackOverflowWhich method of DefaultModelBinder should I override?

Or anybody knows the solution?

l.


The model binder is not used in the view. It is only used to bind request values to action parameters. HTML helpers are used in the view to generate input fields. So it is those html helpers that might need to be customized to show the proper data from your model.

0

精彩评论

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