samedi 6 février 2016

I can't diasable checkbox?

cant disable checkbox??

public void seat_reser_Load(object sender, EventArgs e) { string asd = "";

DataTable dt = ob.dataview("Select * from seat_res where bus_id='"+ bus_select.Id+"'and date='"+bus_select.date +"'");

            foreach (DataRow d in dt.Rows)
            {

                asd += d[2].ToString();  //d[2] is seat colum
                asd+=",";

            }

                box[0] = CheckBox1;
                box[1] = CheckBox2;
                box[2] = checkBox3;
                box[3] = checkBox4;
                box[4] = checkBox5;
                box[5] = checkBox6;
                box[6] = checkBox7;
                box[7] = checkBox8;
                box[8] = checkBox9;
                box[9] = checkBox10;
                box[10] = checkBox11;
                box[11] = checkBox12;
                box[12] = checkBox13;
                box[13] = checkBox14;
                box[14] = checkBox15;
                box[15] = checkBox16;
                box[16] = checkBox17;
                box[17] = checkBox18;
                box[18] = checkBox19;
                box[19] = checkBox20;
                box[20] = checkBox21;
                box[21] = checkBox22;
                box[22] = checkBox23;
                box[23] = checkBox24;
                box[24] = checkBox25;



                for (int h = 0; h < box.Length; h++)
                {
                    box[h].Enabled = true;
                }
                string[] n = asd.Split(',');
                for (int i = 0; i < n.Length; i++)
                {
                    for (int j = 0; j < box.Length; j++)
                    {
                        if (n[i] == box[j].Text)
                        {

                            box[j].Enabled = false;


                            j++;
                        }
                        else if (!(box[j].Enabled==false))
                        {
                            box[j].Enabled = true;
                        }

                    }


                }

        }




Aucun commentaire:

Enregistrer un commentaire