Click here to Skip to main content
15,904,822 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dropdown list ASP .NET Issue: Two Dropdown list- both are data bounded and on Selecting the User name, Date Drop down is auto populated, If there is only 1 date i am not able to select the same. As based on selected date , Data Grid is displayed, only 1 value dates i am unable to select it so that data grid is displayed. Please help me out.
Posted

1 solution

As per as i understand the question,you are selecting names in dropdown and based on that dates are being filled in second dropdown.Now to populate gridview,bind gridview at the same time dates dropdown is being filled.

Also make dates dropdown AutoPostBack="true" and bind gridview again on SelectedIndexChanged event of dates dropdown,so that if you get more then one dates and you change the selection,your grid will also be populated accordingly.

Regards..:)
 
Share this answer
 
Comments
Member 4475977 18-Jun-13 2:07am    
I have already set the AutoPostBack="true", i am getting the values in Drop down list 2, but when only 1 value is present in that dropdownlist2 , i am unable to select it (no event is fired) and when more than i value is there i am able to select the first second one and then select the first one, but only 1one dropdownlist is present, unable to select that one item. Please assist. Thanks :)
Thanks7872 18-Jun-13 2:13am    
I have already mentioned that bind gridview at the same time dates dropdown is being filled.Dont you get that?If there will be only one date,then your gridview will contain data related to that date only[use that selected value in query while binding gridview].
Member 4475977 18-Jun-13 2:30am    
I dont think your are understanding my question.What ever solution you have given wont work for me. I DONT WANT TO LOAD THE GRIDVIEW AFTER SELECTING THE FIRST DROPDOWN. I want it only when i select the Date from Dropdownlist2, datagrid to reflect with selected date.
Thanks7872 18-Jun-13 2:38am    
I completely understand what you trying to convey,but what you do when you have no choice to change index in dropdown? There wont be any selectedindexchanged event,because you have only one index,not any other to change,so where to bind grid in this scenario? Thats why i suggested you to make like that.The thing you are trying can be easily achived if the dropdown has fixed selections(in definition).If you go through the approach i suggested,you will get data instantly after selecting just first value in names dropdown.I hope you understand what i said.

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