Skip to Content
Beginning ASP.NET MVC 1.0
book

Beginning ASP.NET MVC 1.0

by Simone Chiaretta, Keyvan Nayyeri
August 2009
Beginner to intermediate content levelBeginner to intermediate
575 pages
13h 16m
English
Wrox
Content preview from Beginning ASP.NET MVC 1.0

Chapter 10. Components

With ASP.NET MVC, you gain a cleaner way to separate the responsibilities of a Web application and an easier testing experience. Because it's a complete break with the traditional WebForm model, however, it lacks some of WebForms' basic features.

The feature of WebForms you are going to miss the most is server controls. How are you going to achieve the same results using ASP.NET MVC? Can it still be achieved?

In this chapter you see how to encapsulate some portions of your application in components that can be reused in many of your views.

You learn:

  • How to use the server controls

  • How to exploit the partial views

  • How to include behaviors in your components

Before talking about how to achieve this result with ASP.NET MVC, it's important to see why using the server controls available from WebForms is not the best solution anymore.

Why Are There No Server Controls?

The traditional use of server controls won't work with ASP.NET MVC for a couple of reasons.

Reason number one: For a server control to handle its own interactions, the post operation needs to always go back to the same page where the controller has been declared. This was done by using the infamous postback concept that is not used in ASP.NET MVC.

Reason number two: The control has to manipulate things only inside its boundaries and everything that is outside must be sent back to the user as it was before. Again, this was achieved by storing all the contents of a page inside the viewstate of the page. This abstraction ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning ASP.NET MVC 4

Beginning ASP.NET MVC 4

José Rolando Guay Paz
Programming ASP.NET MVC 4

Programming ASP.NET MVC 4

Jess Chadwick, Todd Snyder, Hrusikesh Panda
Professional ASP.NET MVC 2

Professional ASP.NET MVC 2

Jon Galloway, Phil Haack, Scott Hanselman, Scott Guthrie, Rob Conery

Publisher Resources

ISBN: 9780470433997Purchase book