Solved

looping through textboxes in a asp.net web page

Posted on 2011-02-18
2
246 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 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