---
title: "how to get values from dynamically generated text boxes?"  
description: "how to get values from dynamically generated text boxes?"  
author: "Manoj Bhatt"  
published: 2014-09-29  
updated: 2014-09-29  
canonical: https://www.mindstick.com/forum/2283/how-to-get-values-from-dynamically-generated-text-boxes  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 2 minutes  

---

# how to get values from dynamically generated text boxes?

I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to get the [values](https://www.mindstick.com/forum/327/sum-textbox-values) of text box which i generated dynamically on [page load](https://www.mindstick.com/articles/12909/how-to-open-first-time-popup-on-page-load-in-website) and cloned them using jquery....

every text box has a [unique id](https://www.mindstick.com/forum/33873/how-to-get-unique-id-of-alasset-for-identification-in-ios) in form of a [matrix](https://www.mindstick.com/forum/2412/how-to-convert-matrix-to-uiimage) for eg textboxes of row one have ids textbox11,textbox12,textbox13,textbox14 etc for row two textbox21,textbox22,textbox23........

is there any way to get the values..

```
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls; public partial class product_entry : System.Web.UI.Page{    int count;    protected void Page_Load(object sender, EventArgs e)    {        int i, j;        for (i = 0; i < 1; i++)        {            TableRow tr = new TableRow();            tr.Attributes.Add("class", "tabrow");             for (j = 0; j <= 8; j++)            {                TableCell tc = new TableCell();                 if (j == 0)                {                    tc.Controls.Add(new LiteralControl("<Button class=remove type=button>-</button>"));                }                if (j == 1)                {                    tc.Attributes.Add("class", "sno");                }                if (j == 2 || j == 3 || j == 4 || j == 5 || j == 6 || j == 7 || j == 8)                {                    TextBox tb = new TextBox();                    tb.Style["width"] = "98%";                    tc.Controls.Add(tb);                }                tr.Controls.Add(tc);            }            Table1.Controls.Add(tr);        }    }     protected void Button1_Click(object sender, EventArgs e)    {        Label2.Text = TextBox1.Text;    for (int i = 1; i <= count; i++)    {        for (int j = 1; j <= 7; j++)        {            TextBox aa = (TextBox)Pnl.FindControl("textbox" + i + j);            Response.Write(aa.Text);        }    }    }}
```

i want to [fetch](https://www.mindstick.com/forum/156159/what-is-google-fetch) the values of hundreds of [text boxes](https://www.mindstick.com/forum/34261/how-to-split-data-to-text-boxes-when-read-qr-code-data) geerated using jquery by using the loop designed above is there any way to do that

## Replies

### Reply by Sumit Kesarwani

Hi Manoj, \

you can add a specific css class to all dynamically generated text boxes on [page](https://www.mindstick.com/articles/13031/why-to-make-a-wikipedia-page) load and by class selector using Jquery you can access all of them:

Use each: i is the postion in the array, obj is the DOM object that you are iterating (can be accessed with the jQuery wrapper $(this) as well).

```
$('input.SomeClass').each(function(i,obj){ var textboxid = $(this).id;var textboxValue = $(this).val(); // get text inside text box });
```


---

Original Source: https://www.mindstick.com/forum/2283/how-to-get-values-from-dynamically-generated-text-boxes

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
