problem iterating through textboxes

  • Thread starter Thread starter Elmo Watson
  • Start date Start date
E

Elmo Watson

I have 10 sections on my page - -
in each section I have 2 textboxes, named similarly (txtIn/txtOut), but
adding the number to the id - - so it's like txtIn1, txtOut1, txtIn2, etc

I'm trying to iterate through them and check to see if each has text in
them:

Dim iCheck as Integer
Dim sNum as string
Dim txtIn As New TextBox
Dim txtOut As New TextBox


For iCheck = 1 To 10

sNum = iCheck.ToString
txtIn.ID = "txtIn" & sNum
txtOut.ID = "txtOut" & sNum

If txtIn.Text <> "" Or txtOut.Text <> "" Then ' problem here - see below
' do processing here
else
'whatever
End If

Next iCheck

When debugging, in the 'If' statement, the textbox IDs are correct, but, no
matter what, they always show "" as the Text property, but they definitely
do have text - -

What am I doing wrong
 
I thought I'd add - - that when I say sections, each section is a row in an
HTML table and it's all inside an UpdatePanel
 
Back
Top