Archive For July 2007

Displaying One-To-Many Relationships with Nested Repeaters

calendar_today 27 July 2007 14:24

ASP.NET 2.0 ADO.NET ASP.NET Web Forms

This item could also have been entitled "Displaying Master-Detail Data" or "Displaying Categorised Data", but the principal is the same: you have what are essentially headings or categories, and a group of entries that belong to each heading that you want to display. Typical examples would include the Models of cars by Manufacturer, or Employees by Department. Here's how to do it quite simply using nested Repeaters.

Customising a ListControl's DataTextField value

calendar_today 06 July 2007 12:19

ASP.NET 2.0 ASP.NET Web Forms

The DataTextField property is used with ListControls - RadioButtonList, CheckBoxList etc to specify a field in the DataSource property to display as the items of the list in the list control. Sometimes, however, you don't want just the value from one database field to appear in the list, and there are a couple of ways to achieve this, depending on what you want to do.