zoukankan      html  css  js  c++  java
  • select multi option in checkbox group in one time

    Such as:
    there is a checkbox group in a datalist named datalist1. we need to catch the name selected through pressing the button2. the codes is following.
    protected void Button2_Click(object sender, EventArgs e)
        {
            string selectname = "";
            for (int i = 0; i < DataList1.Items.Count; i++)
            {
                bool status = ((CheckBox)DataList1.Items[i].FindControl("CK1")).Checked;
                string username = ((TextBox)DataList1.Items[i].FindControl("TextBox1")).Text;
                if (status)
                    selectname += username+"&";
             }
            Response.Redirect("selectcheckbox.aspx?selectname=" + selectname);
    }
  • 相关阅读:
    JVM相关知识
    面试之mysql专题
    Java新特性
    数据结构操作与算法复杂度分析
    IO流
    浅谈Web安全
    面试题2
    需要知道的HTTP 知识
    How JavaScript Work
    webpack 学习笔记
  • 原文地址:https://www.cnblogs.com/Winston/p/1026463.html
Copyright © 2011-2022 走看看