从数据库中读取,实现省市区联动

private void BindDropDownList(DropDownList drop,List<Model.City>list)

{

  for(int i=0;i <list.count;i++)

  {

    drop.Items.Add(new listitem(list[i].name,list[i].Id));

  }  

}

//默认选中某一项,作为当前项

private void DropDwonListIndex_Bind(DropDownList drop,string name)

{

 for (int i=0;i<drop.items.count;i++)

 {

  if(drop.text==name)

   {

     drop.selectedIndex=i;

  }

 }

 

}

 

posted @ 2012-12-26 09:45  消沉  阅读(808)  评论(0编辑  收藏  举报