Question : Get value From Drop Down List

Hi All,

I am using C#,  and with no code in the code behind file.

I have 2 DropDownLists on my page:

#1 - is populated from the states listed in the db table from the records available and the states available can only be listed once.
#2 - is populated from the matching records in the appropriate state with the dealership name and dealership id....

I have 2 datasources:

#1 - populates the first DropDownList

#2 - populates the second DropDownList

#3 - binds the text boxes and drop down #2 and inserts the data in the database

I can get the states. I can also populate the second drop down. But I can not bind the drop down to add the ID of the selected value.
 
Can anyone offer any suggestions?

There is another datasoursce that is inserting the records also.


Thanks,

 Jus

Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
drop down lists:

##########################################################
    
                                        Select a State...
                                          
                                      
	                                    
                                                                
                                
Dealership Select a Dealership... ################################################# insert ################################################ InsertCommand="INSERT INTO [CAR_Dealers] ([DealerContact_ReferralFee],[Dealership_Id] ) VALUES (@DealerContact_ReferralFee,@Dealership_Id )" #################################################### parameters ################################################### Type="String" />

Answer : Get value From Drop Down List

here is my sample code with two dropdownlist in InsertTemplate.
First dropdown gets all suppliers from suppliers table.
Second dropdown will get products based on the selected supplier.
Compare what you might be missing.
Note: ProductName is string while your dealerID is Int. That should't be a problem as that is already taken care by convert.
The code does insert the selected product from the dropdown without any issue.
 
default.aspx
 
 
default.aspx.cs
 
Random Solutions  
 
programming4us programming4us