欧美日韩一区二区三区四区不卡,日韩欧美视频一区二区三区四区,久久精品欧美一区二区三区不卡,国产精品久久久乱弄

咨詢電話:186 7916 6165 咨詢電話:186 7916 6165 (微信同號)    在線QQ:181796286
NEWS BLOG ·
學無止境
關(guān)注開優(yōu)網(wǎng)絡 關(guān)注前沿
LitJson字符串解析
asp.net 判斷用戶是否使用微信瀏覽器

ASP.NET CheckBoxList綁定 及 獲得到CheckBoxList中選

發(fā)表日期:2016-12-02    文章編輯:南昌開優(yōu)網(wǎng)絡    瀏覽次數(shù):4597    標簽:ASP.NET應用

后臺
----------------------------------------------------------------------------------------------------------------
//綁定
    private void Band()
    {
        this.CheckBoxList1.DataSource = temManager.templateList();
        this.CheckBoxList1.DataTextField = "name";
        this.CheckBoxList1.DataValueField = "id";
        this.CheckBoxList1.DataBind();
    }
------------------------------------------------------------------------------------------------------------------
//得到CheckBoxList中選中的值
    public string getcheck(CheckBoxList checkList, string separator)
    {
        string selval = "";
        for (int i = 0; i < checkList.Items.Count; i++)
        {
            if (checkList.Items[i].Selected)
            {
                selval += "'" + checkList.Items[i].Text + "'" + separator;
            }
        }
        if (selval.Length > 1)
        {
            selval = selval.Substring(0, selval.Length - 1);
        }
        return selval;
    }



使用
string sq = getcheck(this.CheckBoxList1, ",");





循環(huán)選中
------------------------------------------------------------------------------------------------------------------

public void Checked()
    {
        string[] arr = temidllist.Split(',');
        for (int i = 0; i < arr.Length; i++)
        {
            ListItem li = CheckBoxList1.Items.FindByValue(arr[i]);
            if (li != null)
            {
                li.Selected = true;
            }
        }
    }
主站蜘蛛池模板: 福安市| 和静县| 赤水市| 长葛市| 万宁市| 兴宁市| 上饶县| 林西县| 怀集县| 泰和县| 收藏| 灵山县| 安远县| 香港| 祁门县| 福鼎市| 通江县| 连州市| 徐汇区| 甘孜县| 阿图什市| 海淀区| 长丰县| 广丰县| 临海市| 泗阳县| 政和县| 贵溪市| 汤原县| 沙田区| 澳门| 雷州市| 和硕县| 泾源县| 陇西县| 九龙县| 扶余县| 富蕴县| 云梦县| 东城区| 广水市|