using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; public partial class OpenWindow : System.Web.UI.Page { protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); AddRows(); } void AddRows() { for (int x = 0; x < 10; x++) { TableRow tr = new TableRow(); TableCell tc = new TableCell(); CheckBox chk = new CheckBox(); if (x % 2 == 0) chk.Checked = true; tc.Controls.Add(chk); tr.Cells.Add(tc); Table1.Rows.Add(tr); } } protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { foreach (TableRow tr in Table1.Rows) { TableCell temp = tr.Cells[0]; CheckBox check = temp.Controls[0] as CheckBox; Response.Write(check.ClientID+"-"+((check.Checked) ? "true" : "false")+"</br>"); } } }
Hall of Fame Twitter Terms of Service Privacy Policy Contact Us Archives Tell A Friend