Click here to Skip to main content
15,905,232 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i have two DropDownLists inside the GridView Item Tempalte Field,have a parent-child relationship.So, iwant to select some item from the parent dropdown and fill the child dropdown list based on the parent selection.
Posted
Comments
Herman<T>.Instance 23-Aug-11 10:15am    
show your code!!! now it is guessing time.

Implementing Cascading Dropdown List[^] should help you out.
 
Share this answer
 
protected void ddl1_SelectedIndexChanged(object sender, EventArgs e)

{

string foundID = String.Empty;

GridViewRow row = (GridViewRow)((sender) as Control).NamingContainer;

// getting the value from the first dropdownlist

DropDownList ddlfirst = ((sender) as DropDownList);

int ddlfirstSelectedValue = Convert.ToInt32(ddlfirst.SelectedValue);

string firstDropDownListID = ddlfirst.UniqueID;

// and now here is how

DropDownList ddlSecond = row.FindControl("ddl2") as DropDownList;

// your code

}
 
Share this answer
 
v2

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