OptGroupList Control.
Author: John McGlothlin
Date 2/25/2003
=================================================================
Implements the OptGroup tag. OptGroupDropDownList or OptGroupListBox.

The 2 public controls are derived from the base, OptGroupListControl, which derives
from WebControl.

Includes setting DataSource/Members/Fields info at design-time.
=================================================================
Usage:

** Assumes you have SQL Server or MSDE, with the NorthWind table. **

Compile the control and add to the ToolBar. Drop OptGroupDropDownList or OptGroupListBox
on a Page. In Server Explorer, drag the NorthWind "Product" and "Categories" tables onto the
Page. Generate a DataSet. Name it dataSet11 and add both above tables to it.

Set the Data properties of the control as(Design time view doesn't reflect DataSource):

DataSource = dataSet11

DataParentMember = Categories
DataParentRelation = CategoryID
DataParentGroupName = CategoryName

DataChildMember = Products
DataChildRelation = CategoryID
DataChildText = ProductName
DataChildValue = ProductID


In Page_Load, add the following:

if(!Page.IsPostBack)
{		
	sqlDataAdapter1.Fill(dataSet11);
	sqlDataAdapter2.Fill(dataSet11);
	OptGroupDropDownList1.DataSource = dataSet11;
	OptGroupDropDownList1.DataBind(); 
	
	//OptGroupListBox1.DataSource = dataSet11;
	//OptGroupListBox1.DataBind(); 
}

Press F5.

Use .SelectedText or .SelectedValue to get the selected items.
