How to loop through items in Repeater control in vb.net

hi Guys....

I am trying to loop though the items in  repeater control and trying to get the value entered in textbox control when I click a button.

But I am unable to get it.

Please see the attached code.

Please help me regarding this.

Thanks in advance.
Dim test As String
dim txttest  as textBox

For Each item As RepeaterItem In RepItemCollection
            If (item.ItemType = ListItemType.Item) Or _
             (item.ItemType = ListItemType.AlternatingItem) Then

                txttest = CType(item.FindControl("TextBox1"), TextBox)
                If Not IsNothing(txttest) Then
                    j += 1
                    test = txtEnterDCN.Text.ToString()
                Else
                End If
            End If
        Next

Open in new window

rakhy_rakeyAsked:
Who is Participating?
 
rakhy_rakeyAuthor Commented:
hi,

I confirmed that we can not access the value entered by user in a textbox control in Repeater or GridView control.

So I implemented the same thing using Asp.net Table control. Now i am able to get the value.

Thanks,
Rakhy.
0
 
EyalCommented:
does RepItemCollection has items?
0
 
rakhy_rakeyAuthor Commented:
Yes it has...
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
EyalCommented:
in what line you get error?
0
 
rakhy_rakeyAuthor Commented:
I dont get any error. But I get empty value in textbox even after I enter values in text boxes

my repeater collection defined as

  Dim RepItemCollection As RepeaterItemCollection = RepeaterProcApplication.Items
0
 
EyalCommented:
does item.FindControl("TextBox1") return you an object?
0
 
rakhy_rakeyAuthor Commented:
Yes it returns object....
0
 
rakhy_rakeyAuthor Commented:
I found this as the feasibel solution for this problem
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.