Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a one dropdownlist in usercontrol and one dropdownlist in aspx page when i select a usercontrol dropdownlist index means aspx page dropdownlist will be bind the values from database .....how to do this help me
Posted

1 solution

Hi,

On the selected Index change event of the dropdown in user control, add below code.
C#
DropDownList ddlParent = (DropDownList)this.Parent.FindControl("dropdownlist1");
// dropdownlist1 ID of parent dropdownlist
if(ddlParent != null)
{
  //bind the dropdown list
}


hope it helps.
 
Share this answer
 
Comments
Sasikumar.mohan 12-Feb-13 4:41am    
s its vry useful thanks
Karthik Harve 12-Feb-13 6:17am    
Welcome. happy coding :-)
Sasikumar.mohan 12-Feb-13 6:40am    
hmmm how to bind a datatable values in a dropdownlist using datarow foreachloop ..pls help me
Karthik Harve 12-Feb-13 6:46am    
try this.

ddl.Items.Clear();
foreach(DataRow row in dt.Rows)
{
ddl.Items.Add(row["Text"].ToString(),row["Value"].ToString());
}
//Text and Value are the columns in datatable for text and value fields of the dropdownlist

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