Using Programmatic DataBinding

When you bind a DataBound control to a DataSource control, you can take advantage of declarative databinding. When you use declarative databinding, ASP.NET Framework handles all the messy details of deciding when to retrieve the data items represented by a DataSource control.

In certain situations, you want to handle these messy details yourself. For example, you might want to force a GridView control to refresh the data it displays after you add a new record to a database table. Or you might want to bind a DataBound control to a data source that can’t be easily represented by one of the existing DataSource controls. In these situations, you want to use programmatic databinding.

Note

The ASP.NET 1.x Framework ...

Get ASP.NET 4 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.