婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > 如何為CheckBoxList和RadioButtonList添加滾動條

如何為CheckBoxList和RadioButtonList添加滾動條

熱門標簽:聯通官網400電話辦理 地圖標注軟件免費下載 蘇州如何辦理400電話 400電話辦理怎么樣 網絡電話外呼系統上海 臨沂智能電話機器人加盟 百應電話機器人外呼系統 西寧呼叫中心外呼系統線路商 外呼電話機器人成本

如何給CheckBoxList和RadioButtonList添加滾動條?
繼承基類CheckBoxListRadioButtonList,添加滾動屬性,重寫Render方法即可。
屬性列表:

#region 滾動控制
    private bool _ShowScrollBar = false;
    /// summary>
    /// 顯示滾動條
    /// /summary>
    [
    System.ComponentModel.Description("是否顯示顯示滾動條")
    , System.ComponentModel.DefaultValue(false)
    , System.ComponentModel.Category("滾動條設置")
    , System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)
    ]
    public bool ShowScrollBar
    {
      get { return _ShowScrollBar; }
      set { _ShowScrollBar = value; }
    }
    private Overflow _OverflowY = Overflow.auto;
    /// summary>
    /// 豎直滾動條
    /// /summary>
    [
    System.ComponentModel.Description("豎直滾動條")
    , System.ComponentModel.DefaultValue(Overflow.auto)
    , System.ComponentModel.Category("滾動條設置")
    , System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)
    ]
    public Overflow OverflowY
    {
      get { return _OverflowY; }
      set { _OverflowY = value; }
    }
    private Overflow _OverflowX = Overflow.auto;
    /// summary>
    /// 水平滾動條
    /// /summary>
    [
    System.ComponentModel.Description("水平滾動條")
    , System.ComponentModel.DefaultValue(Overflow.auto)
    , System.ComponentModel.Category("滾動條設置")
    , System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)
    ]
    public Overflow OverflowX
    {
      get { return _OverflowX; }
      set { _OverflowX = value; }
    }
    private Unit _ScrollHeight = Unit.Parse("0px");
    /// summary>
    /// 滾動高度
    /// /summary>
    [
    System.ComponentModel.Description("滾動高度")
    , System.ComponentModel.Category("滾動條設置")
     , DefaultValue("0px")
    , System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)
    ]
    public Unit ScrollHeight
    {
      get { return _ScrollHeight; }
      set { _ScrollHeight = value; }
    }
    private Unit _ScrollWidth = Unit.Parse("0px");
    /// summary>
    /// 滾動寬度
    /// /summary>
    [
    System.ComponentModel.Description("滾動寬度")
    , System.ComponentModel.Category("滾動條設置")
    , DefaultValue("0px")
    , System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)
    ]
    public Unit ScrollWidth
    {
      get { return _ScrollWidth; }
      set { _ScrollWidth = value; }
    }
    private string _ScrollCssClass = "";
    /// summary>
    /// 滾動樣式設置
    /// /summary>
    [
    System.ComponentModel.Description("滾動樣式設置")
    , System.ComponentModel.Category("滾動條設置")
    , System.ComponentModel.DefaultValue("")
    , System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)
    ]
    public string ScrollCssClass
    {
      get { return _ScrollCssClass; }
      set { _ScrollCssClass = value; }
    }

    #region 書寫標簽
    void WriteBeginSpan(HtmlTextWriter writer)
    {
      if (this._ShowScrollBar)
      {
        StringBuilder strSpan = new StringBuilder();
        strSpan.Append("span ");
        strSpan.Append(string.Format("style='overflow-y:{0};overflow-x:{1};",
          System.Enum.GetName(typeof(Overflow), this._OverflowY),
          System.Enum.GetName(typeof(Overflow), this._OverflowX)));
        if (this._ScrollHeight.ToString() != "0px")
        {
          strSpan.Append(string.Format("height:{0};", this._ScrollHeight));
        }
        if (this._ScrollWidth.ToString() != "0px")
        {
          strSpan.Append(string.Format("width:{0};", this._ScrollWidth));
        }
        strSpan.Append("';");
        if (!string.IsNullOrEmpty(_ScrollCssClass))
        {
          strSpan.Append(string.Format(" class='{0}'", _ScrollCssClass));
        }
        strSpan.Append(">");
        writer.Write(strSpan.ToString());
      }
    }
    void WriteEndSpan(HtmlTextWriter writer)
    {
      if (this._ShowScrollBar)
      {
        writer.Write("/span>");
      }
    }
    #endregion
    #endregion

重寫Render方法: 

 protected override void Render(HtmlTextWriter writer)
    {
      this.WriteBeginSpan(writer);
      base.Render(writer);
      this.WriteEndSpan(writer);
    } 

就這樣就可以了。
還要定義一個枚舉:

public enum Overflow
  {
    auto = 0,
    hidden = 1,
    scroll = 2,
    visible = 3,
    inherit = 4
  }

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

您可能感興趣的文章:
  • ASP.NET中RadioButtonList綁定后臺數據后觸發點擊事件
  • ASP.NET服務器端控件RadioButtonList,DropDownList,CheckBoxList的取值、賦值用法
  • jquery判斷RadioButtonList和RadioButton中是否有選中項示例
  • js獲取RadioButtonList的Value/Text及選中值等信息實現代碼
  • RadioButtonList綁定圖片及泛型Dictionary應用
  • javascript判斷是否有對RadioButtonList選項選擇
  • ASP.NET jQuery 實例16 通過控件CustomValidator驗證RadioButtonList
  • JQuery中對服務器控件 DropdownList, RadioButtonList, CheckboxList的操作總結
  • jquery獲取ASP.NET服務器端控件dropdownlist和radiobuttonlist生成客戶端HTML標簽后的value和text值
  • ASP.NET控件之RadioButtonList詳解

標簽:聊城 清遠 甘肅 海西 中衛 臨夏 平涼 慶陽

巨人網絡通訊聲明:本文標題《如何為CheckBoxList和RadioButtonList添加滾動條》,本文關鍵詞  如,何為,CheckBoxList,和,RadioButtonList,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《如何為CheckBoxList和RadioButtonList添加滾動條》相關的同類信息!
  • 本頁收集關于如何為CheckBoxList和RadioButtonList添加滾動條的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 林西县| 乌兰察布市| 冀州市| 竹溪县| 涟水县| 靖宇县| 茂名市| 抚顺市| 富川| 上饶市| 华安县| 通江县| 石渠县| 鄢陵县| 抚州市| 大荔县| 清水河县| 乐安县| 高青县| 夏河县| 河东区| 通辽市| 淳化县| 西乌珠穆沁旗| 太白县| 海晏县| 神农架林区| 栾城县| 调兵山市| 慈利县| 宣城市| 奇台县| 大洼县| 婺源县| 稻城县| 宜昌市| 闻喜县| 涪陵区| 德庆县| 陵川县| 沾益县|