|
Subject:
|
Updating a Dropdown list
|
|
Posted By:
|
hutchyman
|
Post Date:
|
2/19/2006 4:56:01 PM
|
Hi all,
I am trying to load data from a database query into a asp:dropdownlist. The idea is to return a complete set of fixtures from a football match and then filter them further so the user can select a date from the drop down list to limit the results.
I have implemented a straight databind to the dropdownlist from a datareader but I want the dropdownlist to load 'after' the first search option has been chosen (by an initial dropdown list), thus filtering them further.
e.g. user selects league 1 from the first drop down list. The query brings back all league 1 fixtures I then want the 2nd dropdownlist populated with the dates retrieved from the first query and when the user selects the 2nd dropdownlist (dates) I want the info displayed.
What do you think my best approach would be, datatable, dataset etc.
All help most appreciated. Paul.
|
|
Reply By:
|
hutchyman
|
Reply Date:
|
2/20/2006 1:30:12 PM
|
Hi To all those that read my topic.
I have managed to figure the problem out by using a datalist. I was looking at the problem to in such a complex manner I failed to spot the obvious I have pasted my code below.
If (Request.QueryString("id") <> "") Then objCmd = New OleDbCommand("SELECT [p].[name], [p].[playerid], [p].[description], [p].[picture1], [p].[picture2], [p].[height], [p].[dob]," & _ "[pp].[description] AS [position] FROM [player] as [p], [playerposition] as [pp]" & _ "WHERE [pp].[positionid]=[p].[positionid] AND p.playerid=" & Request.QueryString("id"), objConn) objRdr = objCmd.ExecuteReader() dlPlayerDetails.DataSource = objRdr dlPlayerDetails.DataBind() dgFirstTeam.visible = "false" objRdr.Close() etc etc......
Where I have 'bolded' the text was my discovery. Before I was literally putting the names of the tables in and not the actual query.
Hope that makes sense and helps anyone in the same problem.
Regards, Paul.
Hutchyman Just Remember Never Give Up.
|