469,580 Members | 1,992 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,580 developers. It's quick & easy.

How to retrieve data from Dynamic Textboxes?

I have dynamically created n number of text boxes in a form like txtQL(1),
txtQL(2) , ...txtQL(n)
How can I retrieve the values in a loop? I'm confused as to how to approach
this! Please help.

I get the error "Referenced object has a value of 'Nothing'". as indicated in
the code below:

For Each c In Controls
If i < maxRow Then
Error txtQLLink(i) = c.FindControl("txtQLLink(" + i & ")")

txtQLUrl(i) = c.FindControl("txtQlUrl(" + i & ")")
If txtQLLink(i).Text <> "" Then
textQLHtml = textQLHtml & txtQLUrl(i).Text & txtQLLink(i).Text
strQL = strQL & txtQLLink(i).Text & "," & txtQLUrl(i).Text
i += 1
End If
End If
Next
Thanks for your time.

Nov 22 '05 #1
1 1218
OK. It works now.

For Each c In Controls
If i < maxRow Then
Dim strTextBoxId = "txtQLLink" + "(" + i.ToString + ")"
txtQLLink(i) = c.FindControl(strTextBoxId)
txtQLUrl(i) = c.FindControl("txtQlUrl" + "(" + i.ToString + ")")
If txtQLLink(i).Text <> "" Then
strQL = strQL & txtQLLink(i).Text & "," & txtQLUrl(i).Text
If i < maxRow Then
strQL = strQL & ","
End If
i += 1
End If
End If
Next
Nov 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by crocketo | last post: by
2 posts views Thread by charliewest | last post: by
4 posts views Thread by Bhavin | last post: by
4 posts views Thread by =?Utf-8?B?RHlsYW5TbWl0aA==?= | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.