15.02.2015 Views

C# 4 and .NET 4

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

MVC ❘ 1259<br />

//routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx")<br />

//{<br />

// Action = PageAction.Details,<br />

// ViewName = "ListDetails",<br />

// Model = DefaultModel<br />

//});<br />

These routes will cause the ListDetails.aspx view to be used whenever the List or Details page actions<br />

are used. The Edit <strong>and</strong> Insert page actions are then not required, since (as mentioned earlier) editing<br />

capabilities are provided inline. An example of this is shown in Figure 42-7.<br />

figure 42-7<br />

further development<br />

This section has really only scratched the surface of what is possible with dynamic data. By combining custom<br />

code with the framework provided, you will find that the possibilities are vast. Having the framework in place<br />

can drastically reduce the work you have to do to access data, while leaving you free to concentrate on the rest of<br />

your web site. There are many resources available that dig much deeper into what is possible, but hopefully this<br />

section has given you enough information to make a start <strong>and</strong> explained what the benefits <strong>and</strong> possibilities are.<br />

mVC<br />

As web site development continues to evolve, new <strong>and</strong> exciting ways to do things continually appear. One of<br />

the most recent (<strong>and</strong> most exciting) developments is the Model-View-Controller architectural pattern for web<br />

sites. This is not a new pattern — in fact the concept is at least 30 years old. However, it hasn’t been used in web<br />

sites for very long, <strong>and</strong> (more importantly in the context of this chapter) has only been integrated with the .<strong>NET</strong><br />

Framework with .<strong>NET</strong> 4. The version included in .<strong>NET</strong> 4 is ASP.<strong>NET</strong> MVC 2, a name that alludes to the fact<br />

that ASP.<strong>NET</strong> MVC has been around for a little while, although it was a separate download before .<strong>NET</strong> 4.<br />

Before looking at the ASP.<strong>NET</strong>-specific implementation of MVC, though, it’s worth taking a step back to<br />

describe what MVC actually means, <strong>and</strong> why it is useful. In this section you will look at:<br />

➤<br />

➤<br />

➤<br />

What MVC is<br />

What ASP.<strong>NET</strong> MVC is<br />

How to build <strong>and</strong> customize ASP.<strong>NET</strong> MVC-based web sites<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!