Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have 2 drop down lists on my application. The user will select a company from he first drop down list which will populate a GridView. The user can then chose to export this information to excel with only one company selected or using the other drop down list select another company.
However I cannot get the GridView to "connect" with the second drop down list as another select parameter as it says the variable is already declared.

Can anyone help me out please?

Many thanks.
Posted
Updated 4-Oct-11 11:51am
v2
Comments
Simon_Whale 4-Oct-11 11:52am    
How are you connecting to your data? Datasets? tableadapaters etc. We could really help you if you posted some of your code as it would make solving your problem easier.
Kschuler 4-Oct-11 14:15pm    
You should also tag your question. For example, what language do you program in? What database are you using, if any, to populate your drop down list/grid view? What version of .Net are you running? Is this a Windows App or a Web Site?

1 solution

Lacking more specific information I'm going to assume a lot and give you a basic windows app solution. The same general principle can be applied to a web app but the implementation is slightly different.

Basically instead of directly connecting the Gridview to your drop down, use the SelectionChangedCommitted event to tell you when the user changes the contents of the drop down. Then directly set the SQL for the gridview to select the data you want. In the first drop down, set the SQL based on the single drop down. In the second, combine the values to produce SQL that will fill the grid with what you need.

Hope that helps. As previously mentioned, remember to tag your posts with language etc. and give enough details so it's easier to give an answer that is a direct solution to your problem rather than just a generic description.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900