一、DropDownList默认选中

开始的笨方法:

foreach (ListItem item in DropDownList1.Items)
                       {
                        if (pet.Category == item.Text)
                       {
                       item.Selected = true;
                            break;
                         }
                       }

师傅指点后--》进化版: this.DropDownList1.Items.FindByText(pet.Sex).Selected = true;

05-08 15:41