 |
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category.
** PLEASE BE SPECIFIC WITH YOUR QUESTION **
When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

June 25th, 2004, 08:52 PM
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
dropdownlist inside datagrid
Hi folks. this is my first question here. I have a datagrid displaying information about shoes. In one of the template columns I have two dropdownlists that show size and color. I have not been able to retreive the selected values and pass them on to the shopping cart page which is basically another datagrid. I guess, my problem is retreiving and passing the values from the dropdownlist inside the datagrid. Any suggestions will be really appreciated. Thanks.
|

June 26th, 2004, 04:46 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Take a look at this article: http://www.dotnetjunkies.com/Tutoria...13EB11DC3.dcik
It explains how to bind the drop down to a new dataset for each item in your "master" dataset. Depending on the amount of records you need to display, this can be pretty slow, as you would need to fire a separate query for *each* item.
You could optimize this by adding a static drop-down (if applicable) or by building up the dataset once, and reusing it.
You can also take a look at Top Questions about the DataGrid Web Server Control. One of he questions deals with the drop-down.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|

June 26th, 2004, 06:07 PM
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Imar
Thanks for replying and the resources.
The dropdownlists inside a templated datagrid column are not databound to a datasource becuase the options they show are very few(static). The basic idea is to be able to let users select a size and a color and keep track of their size and color selection. These selections need to be added to their shopping cart and orders so we and they know what size and color **************** did they order.
The shopping cart is a datagrid and I use stored procedures to load it out of a sql server 2000 database. My AddToCart function is also fired by a stored procedure. I did not think of the **************** and the size issue before writing the application -- very bad planning!
I can provide you more details about my stored procedures and application logic if you think that will help. Thanks. Shailesh
|

June 26th, 2004, 06:34 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
I am not quite sure I understand. Were the articles not helpful for you?
Adding a static drop-down to the grid is even easier than a databound one. Just add it to the markup, and in the ItemCreated event preselect the appropriate item.
And in your Update routine use FindControl again to find the drop-down, and get the selected values.
Doesn't that do the trick? If not, can you specify what you need help with?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|

June 27th, 2004, 02:55 AM
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Imaar
I got it fixed -- I had to make changes to my stored procedures, database tables, and class files to add, store and manipulate those parameters from the dropdrownlists. It is working now. Thanks for responding so promptly. I do have a question about using optional criteria in stored procedures, but I guess I will ask it in the database forum here. Thanks again.
Shailesh
|

June 27th, 2004, 05:18 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
That's great. Glad it's fixed.
The SQL forum indeed seems more appropriate for a question about stored procedures.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Nan`s song by Robbie Williams (Track 14 from the album: Escapology) What's This?
|
|
 |