calculate Total value in Dynamically generated textbox
<p>I am using a Website application,In that website i have created dropdownlist and textboxes as dynamically... That dropdown list contains fees list... I select one type of fees in Drop downlist and enter some amount in textbox.. then i select again one type of fees in Dropdownlist and enter some amount in textbox... and finally i select a text named as Total amount in Dropdownlist it have to automatically generate the total value of the all the textboxes(beforeCreated) in the end of the textbox... </p>

<p>How shall i get the total value at end of the textbox....
Anyone plz tell me the solution of this..
Thanks in Advance...</p>

<p>My Code :
        //This function for creating a grid Which will be added the dynamically generated Dropdownlist and textbox</p>

<pre><code>     public void SetInitalRowFees()
    {
    DataTable dtFees = new DataTable();
    DataRow drFees = null;
    dtFees.Columns.Add(new DataColumn("Sno", typeof(string)));
    dtFees.Columns.Add(new DataColumn("Column1", typeof(string)));
    dtFees.Columns.Add(new DataColumn("Column2", typeof(string)));
    drFees = dtFees.NewRow();
    drFees["Sno"] = 1;
    drFees["Column1"] = string.Empty;
    drFees["Column2"] = string.Empty;
    dtFees.Rows.Add(drFees);
    //Store the DataTable in ViewState
    ViewState["CurrentTableFees"] = dtFees;
    // Session["CurrentTable"] = dt;
    GrdFeesStructure.DataSource = dtFees.DefaultView;
    GrdFeesStructure.DataBind();
}



  //This function is used to add a new dropdownlist and textbox controls

    public void AddFeesStructureGrid()
    {
    int rowIndex = 0;
    if (ViewState["CurrentTableFees"] != null)
    {
        DataTable dtCurrentTable = (DataTable)ViewState["CurrentTableFees"];
        DataRow drCurrentRow = null;
        if (dtCurrentTable.Rows.Count &gt; 0)
        {
            for (int i = 1; i &lt;= dtCurrentTable.Rows.Count; i++)
            {
                DropDownList box1 = (DropDownList)GrdFeesStructure.Rows[rowIndex].Cells[1].FindControl("ddlFeesDetails");
                TextBox box2 = (TextBox)GrdFeesStructure.Rows[rowIndex].Cells[2].FindControl("txtAmount");
                drCurrentRow = dtCurrentTable.NewRow();
                drCurrentRow["Sno"] = i + 1;
                dtCurrentTable.Rows[i - 1]["Column1"] = box1.Text;
                dtCurrentTable.Rows[i - 1]["Column2"] = box2.Text;
                rowIndex++;
            }
            dtCurrentTable.Rows.Add(drCurrentRow);
            ViewState["CurrentTableFees"] = dtCurrentTable;
            GrdFeesStructure.DataSource = dtCurrentTable;
            GrdFeesStructure.DataBind();
        }
    }
    else
    {
        Response.Write("ViewState is null");
    }

    SetFeesStructureData();

}
</code></pre>

<p>Now How shall i do this?</p>
