how get the selections from dynamically created radiobuttonlists in asp.net 2.0?

L

loga123

I have an aspx page where I am creating "radiobuttonlists" dynamically
based on the result from a SQL query. "ID" property of these controls
is set dynamically.
Then...i have a "submit" button on my page which when clicked takes me
to another page.
I want to capture the user selections on the radiobuttonlists in my
previous page.

code looks like this.

page1.aspx (code behind, in page_loadcomplete)

resultFromQuery = <<get the result from query>>
for i = 0 to resultFromQuery - 1
Dim rdl As New RadioButtonList
Dim arr() As String
arr = <<get the list of array values>>
rdl.Font.Size = FontSize.XLarge
rdl.Font.Name = "arial"
rdl.ID = "rdl_" & a(i)
Dim l As Integer
For l = 0 To UBound(arr) - 1
rdl.Items.Add(arr(l))
Next
rdl.RepeatDirection = RepeatDirection.Vertical
next

then a "submit" button whose "postbackUrl" property is set to
"page2.aspx".

Problem is ...I would like to get the user selections on dynamically
created radiobuttonlists (page1.aspx) in page2.aspx?

any ideas??
 
B

Bruno Alexandre

did you tried:


for i = 0 to resultFromQuery - 1
Dim arr() As String
arr = <<get the list of array values>>

mySelectedValue = CType(PreviousPage.FindControl("rdl_" & a(i)),
RadioButtonList).SelectedValue
next
 

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

Top