public CheckBox[] cb = null;
int z=0;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
int count = (int)countcmd.ExecuteScalar();
Int32 k = Convert.ToInt32(Session["TZ"]);
cb = new CheckBox[count - k];
OleDbCommand cmd = new OleDbCommand("Select Member_Name from Member_Master", con);
dr = cmd.ExecuteReader();
while (dr.Read())
{
//creating check box
cb[z] = new CheckBox();
cb[z].Text = dr["Member_Name"].ToString();
Panel2.Controls.Add(cb[z]);
Panel2.Controls.Add(new LiteralControl("</br>"));
// if (z == (t - 1)) { Button6.Visible = true; }
z = z + 1;
}
}
}
protected void Button6_Click(object sender, EventArgs e)
{
//proccess to get the value of checked box and insert into database
cb[tzx] = new CheckBox();
for (int x = 0; x < cb.Length; x++)//ERROR OOCUR HERE
{
//cb[x] = new CheckBox();
if (cb[x].Checked == true)
{
//remain code..
}
}
}
satiss7pwr 0 Newbie Poster
apegram 302 LINQ! Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.