I Have one Panel in that i have One Asp Table Control and One Button.. That Panel Is Dispalying on Ajax ModalPopupExtender.. Im Binding Dynamically created Table to Table Control By using Below Code
public void createspilittable()
{
int count = GridView1.Rows.Count;
if (count != 0)
{
string tgno = string.Empty;
int counts = 0;
TableRow tr = new TableRow();
TableHeaderCell thc1 = new TableHeaderCell();
TableHeaderCell thc2 = new TableHeaderCell();
TableHeaderCell thc3 = new TableHeaderCell();
thc1.Text = "Tag Number";
thc2.Text = "Quantity";
thc3.Text = "Number of Spilits";
tr.Cells.Add(thc1);
tr.Cells.Add(thc2);
tr.Cells.Add(thc3);
tabspilit.Rows.Add(tr);
for (int i = 0; i < count; i++)
{
//GridDataControlFieldCell cell = GrdCustomerData.RowsInViewState[i].Cells[0] as GridDataControlFieldCell;
int ct = 0;
CheckBox chk = GridView1.Rows[i].Cells[0].FindControl("chkselect") as CheckBox;
if (chk.Checked == true)
{
counts = counts + 1;
tgno = tgno + GridView1.Rows[i].Cells[1].Text + ",";
}
}
for (int m = 0; m < counts; m++)
{
int ct = GridView1.Rows[m].RowIndex + 1;
TableRow tr2 = new TableRow();
TableCell tc1 = new TableCell();
TableCell tc2 = new TableCell();
TableCell tc3 = new TableCell();
tr2.Cells.Add(tc1);
tr2.Cells.Add(tc2);
tr2.Cells.Add(tc3);
Label lb1 = new Label();
lb1.Text = GridView1.Rows[m].Cells[1].Text;
tc1.Controls.Add(lb1);
Label lb2 = new Label();
lb2.Text = GridView1.Rows[m].Cells[3].Text;
tc2.Controls.Add(lb2);
TextBox tbqty = new TextBox();
tc3.Controls.Add(tbqty);
tabspilit.Rows.Add(tr2);
// dtspilit.Merge(tabspilit);
}
string newtagnos = tgno.Remove(tgno.Length - 1);
lbltagspilit.Text = newtagnos;
this.ModalPopupspilt.Show();
for (int k = 0; k < count; k++)
{
CheckBox chk = GridView1.Rows[k].Cells[0].FindControl("chkselect") as CheckBox;
if (chk.Checked == true)
{
chk.Checked = false;
}
}
}
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Please Select Items Through Check Boxs to Spilit');", true);
}
}
I need To create Tables as Number Of Rows Present in Above Table ..