Skip to content

Dynamic textbox generate ,fill value but not show sum

Deepak Awashti

Asked Dec 4, 2015, 10:15 PM EST2 answers
Share
LinkedInX
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) 
 
Java
 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)
 
Java
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 

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    all generate textbox input value  ,  button click sum all value 
     
    correct code is urgent.. 
    0
  • 1 short reply
    • 0
      How urgent is this?
       

       
      0