Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,my listbox which inside the gridview and my dropdown is outside the gridview now i want to know how to load the listbox based on the selected index changed on the dropdownlistbox plz help me .....Thanx in advance
Posted

Please share your code snippets where you actually biding data with grid.
Have you tried debugging?
Are you able to fetch data from Database?

There are 3 simple step.
1. On DropDown List SelectedIndex Changed, take the selected values
2. Call you back end database based on the selected value for the dropdown list. Save the data in a dataset or where ever you want.
3. Bind it with Grid view.
 
Share this answer
 
Comments
echosound 10-Sep-12 0:57am    
i want to load the listbox(gridview) based on the dropdown selected index changed how can i access the listbox which is inside the gridview
Prasad_Kulkarni 10-Sep-12 1:03am    
You can access controls inside grid by using FindControl method.
Refer:
Accessing the different controls inside a GridView control[^]
Accessing Different Controls inside the GridView[^]

You can also just get the control from the gridview on postback, and get it's value that way.
echosound 10-Sep-12 1:06am    
findcontrol is not coming in dropdownselectedindexchanged event
Prasad_Kulkarni 10-Sep-12 1:11am    
Please refer the first link I have provided in my comment. It is a CP articles which completely describes with some code snippets. Have a look.
echosound 10-Sep-12 1:18am    
its not working
You can access the listbox through id of the control(listbox) from itemtemplate.

c# code:

ListBox myListBox = (ListBox)gridviewname.rows.FindControl("ListBox1");

hope this will help.
Thanks,
 
Share this answer
 
Comments
echosound 10-Sep-12 1:13am    
findcontrol is not coming in dropdownselectedindexchanged event
echosound 10-Sep-12 1:19am    
i can't able to get the listbox id inside the dropdown selectedindexchange event
Afzal Shaikh 10-Sep-12 1:53am    
create another method(pass aurgument selectedvalue to the method) and call it from selectedindex event and also provide commandname to gridview control and in editcommand event get the findcontrol :)

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