Solved

looping through textboxes in a asp.net web page

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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

20 Experts available now in Live!

Get 1:1 Help Now