Your official information source from the .NET Web Development and Tools group at Microsoft.
This is the first post in the part of series around Model Binding. In this post I will introduce Model Binding integration in ASP.NET WebForms 4.5 while focusing on history, benefits, principles and the integration of Model Binding. In the upcoming posts, I will be going into the details about the features that are supported by this system.
Update: Following are the posts in this series
Model Binding is a system which binds a value submitted from the client to a model on the server so that the model is available for inspection for validation rules and processing on the server. In essence the system has two fundamental functions – Binding & Validation.
In a WebForms application, data binding(from client to server and vice versa) typically happens via Data Bound and Data Source controls. While this approach has the advantages of an experience where you can get your application up and running easily, it does have some drawbacks for some developers who want to tap in more modern ways of developing applications, such as : doing validation using Data Annotations, PRG pattern, Repository patters, cleaner page code behind etc.
Model Binding as a system has existed in many Frameworks. Rails implements the core functions of Binding & Validation in its own way. ASP.NET MVC had Model binding support since its early stages. When ASP.NET MVC2 was released, the team released a prototype of an “Extensible Model Binding system”. This prototype made it possible for a Framework developer to write their own Model Binding system, should they choose to do so.(of course anyone in their right minds would not attempt it, but the ASP.NET team decided anyways to do this for WebForms)
Infact this Extensible Model Binding was how the team derived lots of inspiration from while trying to implement a Model Binding System that integrates the flexibility of Model Binding system and power of controls. ASP.NET WebAPI also derives some inspiration from this extensible model when ASP.NET WebAPI added support for binding using different formatters.
With the introduction of Model Binding, it is now much easier to build modern webforms applications. Following are the areas where this integration adds value
I hope so far this would help you understand the bigger picture with WebForms Model Binding and value it brings to an application developer. As Scott Hanselman noted, this integration also brings ASP.NET MVC/WebForms application development much closer.
In the next post we will be looking at some high level fundamentals and features on Model Binding in WebForms
Nice post Pranav! Look forward to go through the next in this series.
Just got through yr posting!!! Very useful. I am looking forward the upcoming one.
Very nice, really looking forward to the next in the series :)
wow its cool
its very useful and i like it
Thanks for this, Pranav.
There's not a lot of talk about WebForms any more, and that's a shame. In many ways, MVC is a major step backward in development paradigm. Before I get flamed for that, yes, I understand and appreciate the advantages of testability, structure, compartmentalization and the like, but the lack of support in development tools is pathetic, requiring significantly more time to do the same level of work that can be done in a WebForm. It's beginning to feel like the old "Visual" C++ days with MFC.
It's great to see articles like yours helping show that WebForms are viable, extensible, and that there's no need to give up all the nice convenience to use more modern development approaches.
some things that articles like this are missing far too often are, which framework is required, and which ide is required. i very occasionally use VS2010 but mostly still use 2008 - *express*. can i use it? i'd bet 2010 is a minimum.
what are the min requirements to do this work? please include this info in these articles and pass this concept along to everyone so that it becomes standard practice across MS. thanks.
@wazz, this is for .NET 4.5 and VS 2012. I have updated this information in this post...Thank you for your suggestion
I like it alot but having a bear of a time getting validation via required attributes on the model to actually work.
All it does is show asterisks not the required attribute (error message="an error occured") value. But other than that I love it.