//第一種方法
        foreach (Control ct in form1.Controls)
        {
            if (ct.GetType().ToString().Equals("System.Web.UI.WebControls.CheckBox"))
            {
                CheckBox cb = (CheckBox)ct;
                if (cb.Checked == true)
                {
                    Response.Write(cb.Text);
                }
            }
        }

 //第二種方法
        foreach (Control ct in form1.Controls)
        {
            if (ct.GetType().ToString().Equals("System.Web.UI.HtmlControls.HtmlInputCheckBox")) 
            {
                HtmlInputCheckBox cb = (HtmlInputCheckBox)ct;
                if (cb.Checked == true)
                {
                    Response.Write(cb.Value);
                }
            }
        }


arrow
arrow
    全站熱搜

    Roger 發表在 痞客邦 留言(0) 人氣()