Working with Data in ASP.NET 2.0 Nested Data Web Controls

Working with Data in ASP.NET 2.0  Nested Data Web ControlsIn addition to static HTML and databinding syntax, templates can also include Web controls and User Controls. These Web controls can have their properties assigned via declarative, databinding syntax, or can be accessed programmatically in the appropriate serverside event handlers.


In this tutorial we will explore how to use a Repeater nested inside another Repeater. The outer Repeater will contain an item for each category in the database, displaying the category’s name and description. Each category item’s inner Repeater will display information for each product belonging to that category (see Figure 1) in a bulleted list. Our examples will illustrate how to populate the inner Repeater both declaratively and programmatically.

Step 1: Creating the Category Listing
When building a page that uses nested data Web controls, I find it helpful to design, create, and test the outermost data Web control first, without even worrying about the inner nested control. Therefore, let’s start by walking through the steps necessary to add a Repeater to the page that lists the name and description for each category.
Start by opening the NestedControls.aspx page in the DataListRepeaterBasics folder and add a Repeater control to the page, setting its ID property to CategoryList. From the Repeater’s smart tag, choose to create a new ObjectDataSource named CategoriesDataSource.

Website: static.asp.net | Filesize: 433kb
No of Page(s): 10
Click here to download Working with Data in ASP.NET 2.0 Nested Data Web Controls.

Related Copyrighted Books
Advanced ASP.NET AJAX Server Controls For .NET Framework 3.5 (Microsoft .Net Development Series)Advanced ASP.NET AJAX Server Controls For .NET Framework 3.5 (Microsoft .Net Development Series)
Pro ASP.NET 3.5 Server Controls and AJAX ComponentsPro ASP.NET 3.5 Server Controls and AJAX Components
Professional Web Parts and Custom Controls with ASP.NET 2.0 (Wrox Professional Guides)Professional Web Parts and Custom Controls with ASP.NET 2.0 (Wrox Professional Guides)
ASP.NET 2.0: A Developer's NotebookASP.NET 2.0: A Developer’s Notebook
Developing Microsoft  ASP.NET Server Controls and Components (Pro-Developer)Developing Microsoft ASP.NET Server Controls and Components (Pro-Developer)

Related Tutorial

Tags: , ,

Comments

Comments are closed.