How have dropdown refer to Gridview?

V

VB Programmer

ASP.NET 2.0....

Building a shopping cart application.

2 tables: Categories and Products

I have a Gridview representing Products. When the admin selects a row a
DetailsView is populated. In my DetailsView I have a dropdownlist which
pulls Categories from the Categories table. I want to auto-select the
correct Category for the Product that has been selected in the Gridview.
How do I do this?

Thanks.
 
C

Christopher Reed

If you're pulling the Category ID for the Product from your data source,
then you can use this as your SelectedValue for your dropdownlist in the
DetailsView. So, in either your DataBound or ItemCreated event for the
DetailsView, you can set the SelectedValue for your dropdownlist. Is this
what you're looking for?
 
V

VB Programmer

Thanks Christopher!

Christopher Reed said:
If you're pulling the Category ID for the Product from your data source,
then you can use this as your SelectedValue for your dropdownlist in the
DetailsView. So, in either your DataBound or ItemCreated event for the
DetailsView, you can set the SelectedValue for your dropdownlist. Is this
what you're looking for?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top