Handling the ObjectCreating
Event
By default, the ObjectDataSource
control can represent only components that have a constructor that does not require any parameters. If you are forced to use a component that does require parameters for its constructor, you can handle the ObjectDataSource
control’s ObjectCreating
event.
For example, the component in Listing 18.36 must be initialized with a movie category parameter. The component returns only movies in the specified category.
Listing 18.36. MoviesByCategory.cs
The page in Listing 18.37 contains ...
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.