p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

aspdotnet_website_programming thread: Databound ListBox Selection

Message #1 by "D.L. Barton" <dlbarton@s...> on Sat, 22 Feb 2003 20:46:06
I have what I know should be VERY simple. Here's the scenario:
I have a web form with a list box (Rows value set to 1 so that it behaves 
like a combo box, limited only to values in the listbox).
I have two datasets on the form, Representatives and Teams.  The 
relationsihp here is that Representatives are assigned to a Team.  Thus, 
Teams is a 'lookup' dataset/table from which the Representatives choose. 
So, I've set it up (in designer) with these properties:
DataSource: Teams (a DataSet object on the form)
DataMember: Teams (the table within the dataset)
DataTextField: TeamName (to display the TeamName column with the dataset)
DataVaueField: TeamID (the unique identifier of the team and the value 
which should be set with in the Representatives dataset).

So in code when displaying the form I do a Fill on both of the datasets.  
So what I can't seem to get working is to tell ASP that the value of the 
listbox is 'associated' with the contents of the TeamsID field in the 
Representatives dataset.  The listbox fills correctly, but the value 
isn't set because there's no way to (at least in designer) to indicate 
that the data elements for the value of the field comes from a field in 
the Representatives recordset.  This seems like it should be so easy, and 
so common as much as we all use lookup fields, etc.

Thanks in advance for your help.

  Return to Index