Based on your explanation I have assumed certain things and tried to visualize your scenario and came across following solution
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="DynamicApp.Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="mainForm" runat="server">
<div id="textBoxHolder" runat="server"></div>
<asp:Button ID="btnShow" Text="Show" runat="server" OnClick="btnShow_Click" /><br />
<asp:Literal ID="litShow" Text="" runat="server" />
</form>
</body>
</html>
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
namespace DynamicApp
{
public partial class Default : System.Web.UI.Page
{
// data source
List<string> dataTypeList = new List<string> { "text", "date", "number" };
protected void Page_Load(object sender, EventArgs e)
{
// creating dynamic textboxes
var textBoxHolder = (HtmlGenericControl)mainForm.FindControl("textBoxHolder");
var index = 1;
foreach (var item in dataTypeList)
{
var textBox = new TextBox();
textBox.ID = "txtBox" + (index++);
textBox.Attributes["type"] = item;
textBoxHolder.Controls.Add(textBox);
}
}
protected void btnShow_Click(object sender, EventArgs e)
{
// getting textbox values
var textBoxHolder = (HtmlGenericControl)mainForm.FindControl("textBoxHolder");
for (int index = 1; index <= dataTypeList.Count; index++)
{
var textBox = (TextBox)textBoxHolder.FindControl("txtBox" + (index));
litShow.Text += textBox.Text + "<br>";
}
}
}
}
The aspx file is straight forward I have took one button and a literal; also a textBoxHolder which will hold my dynamic textboxes
In the code behind aspx.cs I have made a dummy data source "dataTypeList" with 3 different types then on the page load I am creating and adding dynamic textboxes to the page. Next on btnShow click I am just fetching values from these dynamic textboxes and displaying the text in literal
Sorry if my assumptions are not as per your scenario.
Hope it helps