校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁(yè) > 知識(shí)庫(kù) > 如何為CheckBoxList和RadioButtonList添加滾動(dòng)條

如何為CheckBoxList和RadioButtonList添加滾動(dòng)條

熱門(mén)標(biāo)簽:聯(lián)通官網(wǎng)400電話辦理 地圖標(biāo)注軟件免費(fèi)下載 蘇州如何辦理400電話 400電話辦理怎么樣 網(wǎng)絡(luò)電話外呼系統(tǒng)上海 臨沂智能電話機(jī)器人加盟 百應(yīng)電話機(jī)器人外呼系統(tǒng) 西寧呼叫中心外呼系統(tǒng)線路商 外呼電話機(jī)器人成本

如何給CheckBoxList和RadioButtonList添加滾動(dòng)條?
繼承基類(lèi)CheckBoxListRadioButtonList,添加滾動(dòng)屬性,重寫(xiě)Render方法即可。
屬性列表:

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

    #region 書(shū)寫(xiě)標(biāo)簽
    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

重寫(xiě)Render方法: 

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

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

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

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

您可能感興趣的文章:
  • ASP.NET中RadioButtonList綁定后臺(tái)數(shù)據(jù)后觸發(fā)點(diǎn)擊事件
  • ASP.NET服務(wù)器端控件RadioButtonList,DropDownList,CheckBoxList的取值、賦值用法
  • jquery判斷RadioButtonList和RadioButton中是否有選中項(xiàng)示例
  • js獲取RadioButtonList的Value/Text及選中值等信息實(shí)現(xiàn)代碼
  • RadioButtonList綁定圖片及泛型Dictionary應(yīng)用
  • javascript判斷是否有對(duì)RadioButtonList選項(xiàng)選擇
  • ASP.NET jQuery 實(shí)例16 通過(guò)控件CustomValidator驗(yàn)證RadioButtonList
  • JQuery中對(duì)服務(wù)器控件 DropdownList, RadioButtonList, CheckboxList的操作總結(jié)
  • jquery獲取ASP.NET服務(wù)器端控件dropdownlist和radiobuttonlist生成客戶(hù)端HTML標(biāo)簽后的value和text值
  • ASP.NET控件之RadioButtonList詳解

標(biāo)簽:聊城 清遠(yuǎn) 甘肅 海西 中衛(wèi) 臨夏 慶陽(yáng)

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《如何為CheckBoxList和RadioButtonList添加滾動(dòng)條》,本文關(guān)鍵詞  如,何為,CheckBoxList,和,RadioButtonList,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《如何為CheckBoxList和RadioButtonList添加滾動(dòng)條》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于如何為CheckBoxList和RadioButtonList添加滾動(dòng)條的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 佛山市| 虞城县| 中西区| 南通市| 且末县| 漳州市| 教育| 从化市| 虎林市| 元阳县| 阆中市| 公主岭市| 曲沃县| 尤溪县| 北票市| 邹平县| 淮阳县| 雷波县| 登封市| 台山市| 五大连池市| 启东市| 通化市| 尼玛县| 咸丰县| 彝良县| 鲜城| 天峨县| 南京市| 濮阳市| 塘沽区| 南雄市| 松桃| 乌兰察布市| 都匀市| 疏勒县| 九龙城区| 金平| 黄大仙区| 湘乡市| 舞钢市|