Hi experts
I am makin a .net web application..on page.aspx i ve 2 ddl of states and cities.When i select option in ddlstate i get corresponding cities , but when i again select a state , i get cities corresponding to present as well as previous state that i selected earlier.How should i solve this??
(i ve used database table to access cities corresponding to states using arraylist)
code behind for selected index changed---
void ddlstate_selectedindexchanged(object sender,event args e)
{
class1 c1=new class1(); //class1 contains method fillcity that has returns cities in arraylist
arraylist al=new arraylist();
al=null//initialising arraylist
al=c2.fillcity(ddl.selecteditem.text);//fillcity has input parameter as state which has tp be selected
for(int i=0;i<al.count;i++)
{
class2 c2=(class2)al;//class2 is anotehr class that has variables state and city defined
ddlcity.items.add(new listitem(c2.city,c2.city)
}
}
I am makin a .net web application..on page.aspx i ve 2 ddl of states and cities.When i select option in ddlstate i get corresponding cities , but when i again select a state , i get cities corresponding to present as well as previous state that i selected earlier.How should i solve this??
(i ve used database table to access cities corresponding to states using arraylist)
code behind for selected index changed---
void ddlstate_selectedindexchanged(object sender,event args e)
{
class1 c1=new class1(); //class1 contains method fillcity that has returns cities in arraylist
arraylist al=new arraylist();
al=null//initialising arraylist
al=c2.fillcity(ddl.selecteditem.text);//fillcity has input parameter as state which has tp be selected
for(int i=0;i<al.count;i++)
{
class2 c2=(class2)al;//class2 is anotehr class that has variables state and city defined
ddlcity.items.add(new listitem(c2.city,c2.city)
}
}