DropDownList默认选中

一、DropDownList默认选中

开始的笨方法:

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

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

上一篇:(四十六)c#Winform自定义控件-水波进度条


下一篇:NGUI 渲染流程深入研究 (UIDrawCall UIGeometry UIPanel UIWidget)