开发者

How ASP.NET MVC knows which property of JavaScript control to use when binding?

开发者 https://www.devze.com 2023-01-20 23:04 出处:网络
I know it\'s possible to change view representation of any .NET type by changing strongly-typed partial view. T开发者_开发百科he most popular example is when simple ToString() call on DateTime instanc

I know it's possible to change view representation of any .NET type by changing strongly-typed partial view. T开发者_开发百科he most popular example is when simple ToString() call on DateTime instance is changed to a great-looking JQuery UI calendar.

My question is - how does ASP.NET MVC know what property of JavaScript control to use when binding to a property of a view model? Is there a convention for that (or at least Phil Haack post about it)? If it is, both ASP.NET MVC and JS library requires some kind of rule, or only one side?


The model binder knows nothing about javascript. When binding action parameters it looks at the request sent to the server and binds properties using conventions. Scot Hanselman blogged about some advanced binding conventions used by the binder.

0

精彩评论

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