Deepak Awashti

Deepak Awashti

  • NA
  • 301
  • 71.3k

Dynamic textbox generate ,fill value but not show sum

Dec 5 2015 3:15 AM
i have generate dynamic textbox but not find the value in dynamic text box  , so my problem is ... i am not find the total sum of all text box 
 
pls help me
 
-------------  Button Code (Generate text box) 
 
protected void Button1_Click(object sender, EventArgs e)
{
int rc = Convert.ToInt32(TextBox1.Text);
int cc = Convert.ToInt32(TextBox2.Text);
Table tb = new Table();
tb.ID = "table1";
for (int i = 0; i < rc; i++)
{
TableRow tr = new TableRow();
for (int j = 0; j < cc; j++)
{
TableCell tc = new TableCell();
TextBox TxtBox = new TextBox();
TxtBox.ID = "Txtbox" + i+j.ToString();
tc.ID = "cell" + i.ToString();
tc.Controls.Add(TxtBox);
tr.Cells.Add(tc);
}
tb.Rows.Add(tr);
}
Panel1.Controls.Add(tb);
}
 
 
--------------- Button Code (Sum all text box value)
 
protected void Button2_Click(object sender, EventArgs e)
{
int rc = Convert.ToInt32(TextBox1.Text);
int cc = Convert.ToInt32(TextBox2.Text);
Table tb = new Table();
tb.ID = "table1";
for (int i = 0; i < rc; i++)
{
TableRow tr = new TableRow();
for (int j = 0; j < cc; j++)
{
TableCell tc = new TableCell();
TextBox TxtBox = new TextBox();
TxtBox.ID = "Txtbox" + i + j.ToString();
string strTemp = "Txtbox" + i + j.ToString();
TextBox tb1 = (TextBox)FindControl("TextBox2");
TextBox txt1 = (TextBox)Panel1.FindControl("TextBox2");
}
tb.Rows.Add(tr);
}
}
 
 
pls help me .... in urgent 

Answers (2)