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);
            }
        }
    }
    用心写代码,不辜负程序员之名。
  • 相关阅读:
    火柴排队sol
    国王游戏sol
    子串sol
    跳石头
    解方程sol
    花匠sol
    字符串整理
    计算系数
    矩阵取数游戏sol
    8.2_java_28
  • 原文地址:https://www.cnblogs.com/thinkingthigh/p/3044673.html
Copyright © 2011-2022 走看看