Reference - Getting all values from a repeater control - asp.net

M

mrwoopey

I did not see code for getting all values from a repeater control
posted anywhere. So, I figured it out and I am posting for the next
person that may need it (sorry if this seems obvious to you):

'''''''''''''''''''''''''''''''''''''

Dim strValue As String
Dim objCTL As Control

For Each objCTL In RepeaterExisting.Controls
strValue = objCTL.GetType.ToString
If strValue = "System.Web.UI.WebControls.RepeaterItem"
Then

Dim objCurrentRepeaterItem As RepeaterItem =
DirectCast(objCTL, RepeaterItem)

If objCurrentRepeaterItem.ItemType.ToString = "Item"
Or objCurrentRepeaterItem.ItemType.ToString = "AlternatingItem" Then

Dim objDDL As DropDownList =
DirectCast(objCurrentRepeaterItem.Controls(1), DropDownList)


Dim objDLC As DataBoundLiteralControl =
DirectCast(objCurrentRepeaterItem.Controls(0),
DataBoundLiteralControl)

lblMessage.Text = lblMessage.Text & " Drop down =
" & objDDL.SelectedValue & ", source = " & objDLC.Text() & "<BR>"

End If

End If

Next

''''''''''''''''''''''''''''''''''''''

Phin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top