reference dynamic objects

H

hansiman

some code creates DropDownLists dynamically:

For i = 0 to ubound(arrayStatus)
Dim ddl As New DropDownList
With ddl
.ID = "item_" & i
.DataSource = dsSTATUS
.DataValueField = "StatusID"
.DataTextField = "Status"
.DataBind()
End With
Next

how do I reference these ddl in the button_click code?

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
.....

What I wanted (fails)
sValue0 = ddl.item0.SelectedValue fails

What I did:
Dim sValue0 As String = Trim(Request.Form("item_0"))

/M
 

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,780
Messages
2,569,611
Members
45,277
Latest member
VytoKetoReview

Latest Threads

Top