循环repeater中的个数并且访问repeater中的控件

    xiaoxiao2021-09-07  123

    protected void button_Click(object sender, EventArgs e)

            {

                for (int i = 0; i <repeater.Items.Count; i++)

                {

                    CheckBox chksel = (CheckBox)DataList1.Items[i].FindControl("selected");

                    if (chksel != null)

                    {

                        if (chksel.Checked)

                        {

                          

                            string users = ((Label)DataList1.Items[i].FindControl("users")).Text;

                            string dept = ((Label)DataList1.Items[i].FindControl("dept")).Text;

                            string post = ((Label)DataList1.Items[i].FindControl("post")).Text;

     sql.ExecuteDataset("insert into addnightsalary (users,dept,post,salary,date,days,salarys,mark)values('"+users+"','"+dept+"','"+post+"','"+TextBox3.Text+"','"+TextBox6.Text+"','"+TextBox4.Text+"','"+TextBox5.Text+"','"+TextBox7.Text+"')", "a");

                        }

                    }

     

                }

     

     

            }

    转载请注明原文地址: https://ju.6miu.com/read-677478.html

    最新回复(0)