乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      SelectedValue與SelectedItem.Value的區(qū)別

       悟靜 2012-01-31
      public virtual ListItem SelectedItem {
          get {
              int selectedIndex = this.SelectedIndex;
              if (selectedIndex >= 0) {
                  return this.Items[selectedIndex];
              }
              return null;
          }
      }
      public virtual string SelectedValue {
          get {
              int selectedIndex = this.SelectedIndex;
              if (selectedIndex >= 0) {
                  return this.Items[selectedIndex].Value;
              }
              return string.Empty;
          }
      }

      在沒有選定任何項(xiàng)的情況下,SelectedValue默認(rèn)值是string.Empty,而SelectedItem默認(rèn)值是null(也就是說通過SelectedItem.Value可能發(fā)生異常)因此需要設(shè)定默認(rèn)值:添加items.add("未選定",0,) 避免異常?。?/FONT>

      1. selectedIndex——指的是dropdownlist中選項(xiàng)的索引,為int,從0開始,可讀可寫

      2. selectedItem——指的是選中的dropdownlist中選項(xiàng),為ListItem,只讀不寫

      3. selectedValue——指的是選中的dropdownlist中選項(xiàng)的值,為string, 只讀不寫

      4. selectedItem.Text——指的是選中的dropdownlist中選項(xiàng)的文本內(nèi)容,與selectedItems的值一樣為string,可讀可寫

      5. selectedItem.value——指的是選中的dropdownlist中選項(xiàng)的值,與selectedValue的值一樣,為string,可讀可寫

      光看文字可能不太理解,我也是通過程序來加深理解的,下面舉個例子:

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多