Using Dynamic Data in ASP.NET Applications

ASP.NET Dynamic Data has the ability to infer at run time the appearance and behavior of data fields from the underlying database. It uses this information to select appropriate templates to render the data. Templates eliminate the need to redesign the UI every time that you want to display a table.

This topic describes the main scenarios for using ASP.NET Dynamic Data.

Enabling Dynamic Data for Individual Data-Bound Controls in Existing Web Applications

You can use Dynamic Data features in existing ASP.NET Web applications that do not use scaffolding by enabling Dynamic Data for individual data-bound controls. Dynamic Data provides the presentation and data layer support for rendering these controls. When you enable Dynamic Data for data-bound controls, you get the following benefits:

  • Setting default values for data fields. Dynamic Data enables you to provide default values at run time for fields in a data control.

  • Interacting with the database without creating and registering a data model. Data-bound controls that support Dynamic Data can interact with the database by using any data source, without scaffolding. This avoids having to configure a LINQ to SQL or Entity Framework data model and use the LinqDataSource and EntityDataSource controls.

  • Automatically validating the data that is entered by the user without writing any code.

When you use this approach, Dynamic Data performs all the tasks for accessing and rendering data. You must write a small amount of code, and you do have limited control over Dynamic Data operations.

You can enable dynamic behavior in ASP.NET data-bound controls by using methods in the DynamicDataExtensions class. For more information, see Walkthrough: Enabling Dynamic Data in ASP.NET Data-Bound Controls.

Creating Data-Driven Web Applications Using Scaffolding

Dynamic Data supports scaffolding, which can automatically generate UI to display and edit data. This approach lets you create a new data-driven Web application using little or no code. The application lets you customize the behavior of the application at both the presentation layer and the data layer.

ASP.NET Dynamic Data includes the following classes that help you use dynamic features in your pages:

These classes enable you to perform the following tasks:

When you use this approach, Dynamic Data performs all the tasks that are required for accessing and rendering data. You must write a small amount of code, but you have full control over Dynamic Data operations. This approach cannot be used in existing Web applications that do not use scaffolding.

For more information, see Walkthrough: Creating a New Dynamic Data Web Site Using Scaffolding.

Using Dynamic Data in Existing Web Applications

You can use Dynamic Data features in a new or existing Web application by integrating the required scaffolding elements. This enables you to use your own Web organization, and not the predefined scaffolding, while fully utilizing the Dynamic Data features. This lets you take advantage of tested components and provides control over customization.

Integrating Dynamic Data in your own Web application provides the following benefits:

When you use this approach, Dynamic Data performs all the tasks that are required for accessing and rendering data. You have to write some code to integrate Dynamic Data behavior, but you have full control on Dynamic Data operations.

For more information, see Walkthrough: Adding Dynamic Data to Existing ASP.NET Web Sites.

See Also

Concepts

ASP.NET Dynamic Data Overview

ASP.NET Dynamic Data Scaffolding

Customizing ASP.NET Dynamic Data