I have a button when i click on button then 3textBoxes generated first time and then after it two textboxes generated.I want toget value oftbtextbox in 3rd textbox.I mean sum of textbox in 3rd textbox.But I'm gettingnullvalue oftextbox`.

 <asp:ScriptManager runat="server"></asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
             <asp:Button ID="Button1" runat="server" Text="Add New" OnClick="create" />
    <asp:Panel ID="Panel1" runat="server"></asp:Panel>


  protected void Page_Load(object sender, EventArgs e)


     static int i = 0;
    TextBox tb;
    TextBox tb2;
    TextBox total;
    int j;

    public void create(object sender, EventArgs e)
         int TOTAL;
         TOTAL = 0;
        for ( j = 1; j <= i; j++)

            tb = new TextBox();
            tb2 = new TextBox();
            total = new TextBox();
            tb.ID = j.ToString();
            Label lbl = new Label();
            lbl.Text = "Enter question";
           Label l2 = new Label();
           l2.Text = "Enter Marks";
           tb2.ID = "tb" + j;

           Panel1.Controls.Add(new LiteralControl("<br />"));
           Panel1.Controls.Add(new LiteralControl("<br />"));

        Label res = new Label();
        res.Text = "Total Marks";
       total.Text = TOTAL.ToString();


I want this When i insert value in marks textbox and press button addNew then value display in 3rd textbox again i insert value in marks textbox then sum of marks show in 3rd textbox

Related posts

Recent Viewed