Click here to Skip to main content
16,021,125 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a dropdownlist1 in my page and dropdownlist2 inside gridview.

i binded data from database to dropdownlist1. Based On selected value from dropdownlist1 the related datalist from different row inside the database must be binded to dropdownlist2 inside the gridview.

can any one help me ..........
Posted

1 solution

HI,

Use the selectedIndexChanged method for your purpose. A sample code below for reference.

XML
protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
   {
       IList<State> states = GetStateList(GetCountryList()[((DropDownList)sender).SelectedIndex]);
       ddlStates.DataSource = states;
       ddlStates.DataBind();
   }


[Edit]

Links that will help you understanding your problem are as follows.

Asp.Net - How to Bind a DropDownList to a Database table in GridView?
Dropdownlist inside the Gridview in ASP.NET

Thanks
 
Share this answer
 
v2
Comments
Member 9660789 8-Aug-13 6:52am    
Thanks for your reply but i need to bind related list to dropdownlist2 inside the gridview...
Is the code is for that ply guide me clearly.....
[no name] 8-Aug-13 8:31am    
I have updated my solution please check.

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