在asp.net中,比如说dropdownlist中有两个值"男"、"女",当我取得一个值时,用哪个函数找到匹配当前值?
 比如:
string cur_str = "女";
dropdownlist.(函数) = cur_str;

解决方案 »

  1.   


    if(ddlHRFrom.SelectedItem.Value =="女";)
    ddlHRFrom.SelectedIndex == 0
      

  2.   

    怎样遍历一个dropdownlist控件所有的值?分不够再加
      

  3.   

    还是不行了,是这样的,另一个页面传一个参数过来,这个页面接受这个值时,选中dropdownlist控件里对应的值(控件里肯定包含这个值了),但是老是在第一个选项,没有被选中。
      

  4.   

    ListItem item=D_name_en_short_jgxy.Items.FindByText("wahaha");
    if(item!=null)
    {
    D_name_en_short_jgxy.SelectedIndex=-1;
    item.Selected=true;
    }
    试试这个
      

  5.   

    dropdownlist.SelectedValue= cur_str;