zoukankan      html  css  js  c++  java
  • checkboxlist 多选项获值

    using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    
    namespace CSCDF.Web
    {
        public partial class test : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack) 
                {
                    BindchkCountry();
                }
                
            }
            protected void BindchkCountry()
            {
                CSCDF.BLL.Country countrybll = new CSCDF.BLL.Country();
                DataSet ds = new DataSet();
                ds = countrybll.GetList("");
                chkCountry.DataTextField = "CountryName";
                chkCountry.DataValueField = "CountryID";
                chkCountry.DataSource = ds;
                chkCountry.DataBind();
            }
    
            protected void btnTest_Click(object sender, EventArgs e)
            {
                string s="";
                for (int i = 0; i < chkCountry.Items.Count; i++)
                {
                    if (chkCountry.Items[i].Selected) 
                    {
                        s += chkCountry.Items[i].Value.Trim()+"|";
                    }   
                } 
    
                Maticsoft.Common.MessageBox.Show(this,s);
            }
        }
    }
    用心写代码,不辜负程序员之名。
  • 相关阅读:
    Docker ntpdate Permition error
    Sublime+Golang Plugin
    顺序表和链表的区别
    Python 性能优化——对象绑定
    Fix git 提交代码错误
    UVa 10523
    UVa 10551
    UVa 10814
    UVa 10925
    Practice Round China New Grad Test 2014 报告
  • 原文地址:https://www.cnblogs.com/thinkingthigh/p/3044673.html
Copyright © 2011-2022 走看看