[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

looping through textboxes in a asp.net web page

Posted on 2011-02-18
2
Medium Priority
?
252 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Integration Management Part 2
Loops Section Overview
Suggested Courses

831 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