DropDownList 設定預設值

  • 7071
  • 0

摘要:DropDownList 設定預設值

01 int j=DropListROLE_RELATIONSHIP_U.Items.Count;  //取的items個數
02 for (int i = 1; i < j; i++)
03 {
04        arryStr = DropListROLE_RELATIONSHIP_U.Items[i].Text;
05        //逐一比對
06        if (arryStr == roleRelationship)
07        {
08            DropListROLE_RELATIONSHIP_U.SelectedIndex = i; //設定預設值
09         }

10   }