Solved

looping through textboxes in a asp.net web page

Posted on 2011-02-18
2
241 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now