barrykellett
Programmer
How do I retain information from a dynamically created drop down list when the list posts back to the server? I think that is my problem when i try to use the selected item in a dropdownlist as the selection is in a different sub procedure than the creation of the list.
has a very good article on dynamically creating a drop down list. How do I reference an item from this dynamically created list?I have tried using; lstcategory.SelectedItem.Value, however when i choose from the list i want the chosen item to be inserted into my new sql query using the following code:
cmdSelectProducts = New OleDbCommand( "Select * From Products Where Prod_type= '@Type'" , conProducts)
cmdSelectProducts.Parameters.Add( "@Type", lstcategory.SelectedItem.Value)
It doesnt return any errors, but it returns nothing when it should obviously return several items as the product type list is generated from the database.
I have the autopost back property of my drop down list set to true, and I think that when the dropdownlist is changed the actual parameter insertion into the SQL Query is entering a blank string, hence no results. If i hard code the text into the query it returns the necessary items.
has a very good article on dynamically creating a drop down list. How do I reference an item from this dynamically created list?I have tried using; lstcategory.SelectedItem.Value, however when i choose from the list i want the chosen item to be inserted into my new sql query using the following code:
cmdSelectProducts = New OleDbCommand( "Select * From Products Where Prod_type= '@Type'" , conProducts)
cmdSelectProducts.Parameters.Add( "@Type", lstcategory.SelectedItem.Value)
It doesnt return any errors, but it returns nothing when it should obviously return several items as the product type list is generated from the database.
I have the autopost back property of my drop down list set to true, and I think that when the dropdownlist is changed the actual parameter insertion into the SQL Query is entering a blank string, hence no results. If i hard code the text into the query it returns the necessary items.