Click here to Skip to main content
15,891,744 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi every body , I have two drop down list one is filtrated based on the other its work fine , i want to search in my two dropdowns by text so im using this code :
ddlsociete.SelectedIndex = ddlsociete.Items.IndexOf(ddlsociete.Items.FindByText("sapmleofSociete"));
 
 
ddlba.SelectedIndex = ddlba.Items.IndexOf(ddlba.Items.FindByText(("sampleOFba")));

ddlba is filtred based on selecteditem of ddlsoc , when i run the code below i have ddlsoc with selectedindex with "sampleofsociete" but ddlba its always empty ? i understand because it dosenet have any items so how to get
selected item from selected index ??
Posted
Comments
Sandeep Mewara 27-May-11 0:00am    
Your logic for cascading is not clear to me.
1. Any specific reason why you chose to use 'selected index & selectedtext'?
2. your code sample never filters based on previous one. They look totally independent.

1 solution

Change your code like
ddlsociete.SelectedIndex = ddlsociete.Items.IndexOf(ddlsociete.Items.FindByText("sapmleofSociete"));
 
Fillddlba(); 
ddlba.SelectedIndex = ddlba.Items.IndexOf(ddlba.Items.FindByText(("sampleOFba")));


void Fillddlba()
{
// write here code to fill items on second dropdown base on selected value of first dropdown
}


hope this will work for you otherwise let me know.
 
Share this answer
 

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