Solved

looping through textboxes in a asp.net web page

Posted on 2011-02-18
2
245 Views
Last Modified: 2012-05-11
I have textboxes txtSKU1, txtSKU2 .....txtSKU10

How can I loop through these textboxes and get there text values in a loop as follows?
 For count as integer = 1 to 10
Dim strTxtSKU as string = "txtSKU $count.tostring()
Next

Please suggest. Thanks

0
Comment
Question by:TrialUser
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 34929836
Try:
Dim tb As TextBox
For i As Integer = 1 To 10
    tb = CType(Page.FindControl("txtSKU" & i.ToString(), TextBox)
    If tb <> Nothing Then
            '// Do something with the textbox
    End If
Next

Open in new window

0
 

Author Closing Comment

by:TrialUser
ID: 34960585
perfect thanks a ton for your help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question