I'm new to coding, hope some can help me a bit, I got stuck at retrieving data from my Dynamically added Text boxes in ASP.NET.

I Master Site and a Content site. I have added some buttons to the content site there are adding or removing the textboxes, after what's needed by the user.

My problem is, that i'm not sure how to retrieve the data correct. hope some body can help me on the way.

**My Content site:**

```
<%@ Page Title="" Language="C#" MasterPageFile="~/main.master" AutoEventWireup="true" CodeFile="CreateRMA.aspx.cs" Inherits="CreateRMA" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="mainsite" Runat="Server">

<div id="div_fortext" class="div_fortext">
    <p class="header2">
        Opret RMA Sag
    </p>

    <p class="text1">
        Her Kan de oprette alt det udstyr der skal sendes til reperation hos zenitel.
    </p>
</div>

<div id="div_insert_devices"  runat="server">   

</div>
      // 3 buttons one who add, one who remove textboxes and a submit button
<asp:Button ID="btnAddRow" runat="server" Text="Add Row" CssClass="butten1" OnClick="btnAddRow_Click" />
<asp:Button ID="btnRemoveRow" runat="server" Text="Remove Row" CssClass="butten1" OnClick="btnRemoveRow_Click" />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" CssClass="butten1" OnClick="btnSubmit_Click" />

</asp:Content>

```

**My C# code behind:**

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class CreateRMA : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ViewState["DeviceCount"] = ViewState["DeviceCount"] == null ? 1 : ViewState["DeviceCount"];
            InsertLine();
        }
    }

    private void InsertLine()
    {
        int DeviceCount = int.Parse(ViewState["DeviceCount"].ToString());

        for (int i = 0; i < DeviceCount; i++)
        {
            LiteralControl text = new LiteralControl("<div class=\"divPerDevice\">");
            div_insert_devices.Controls.Add(text);

            TextBox txtbox = new TextBox();
            txtbox.ID = "serial" + i;
            txtbox.CssClass = "textbox1";
            txtbox.Attributes.Add("runat", "Server");
            div_insert_devices.Controls.Add(txtbox);

            text = new LiteralControl("</div>");
            div_insert_devices.Controls.Add(text);
        }    
    }

    protected void btnAddRow_Click(object sender, EventArgs e)
    {
        int count = int.Parse(ViewState["DeviceCount"].ToString());     
        count++;

        ViewState["DeviceCount"] = count;
        InsertLine();
    }

    protected void btnRemoveRow_Click(object sender, EventArgs e)
    {
        int count = int.Parse(ViewState["DeviceCount"].ToString());
        count--;
        ViewState["DeviceCount"] = count;
        InsertLine();
    }

    protected void btnSubmit_Click(object sender, EventArgs e)
    {   
        // Submit - save the textboxes to Strings ??? Can any body help
    }
}

```