Using a RadioButtonList in a dynamic table

R

Rob

Does anyone have an idea on how to do this?
I have a query that dynamicaly creates RadioButtonLists and I need to
set each radio button in a dynamic cell of a table. Here's my code:

Dim dr As SqlDataReader =
cm.ExecuteReader(CommandBehavior.CloseConnection)
Do While dr.Read
'initialize the radiobuttonlist
rbList = New RadioButtonList
rbList.ID = dr.GetInt32(0)

tr = New TableRow
'add an image for the visitor to the cell
vImage = New Image
vImage.ImageUrl = "images/teams/" & dr.GetString(4)
tdVimage = New TableCell
tdVimage.Controls.Add(vImage)
tr.Controls.Add(tdVimage)

td1 = New TableCell
rbList.DataValueField = dr.GetInt32(6)
rbList.Items.Add(New ListItem(dr.GetString(2)))
td1.Controls.Add(rbList)
tr.Controls.Add(td1)

td2 = New TableCell
rbList.DataValueField = dr.GetInt32("0")
rbList.Items.Add(New ListItem("Tie"))
td2.Controls.Add(rbList)
tr.Controls.Add(td2)


'add an image for the home team
hImage = New Image
hImage.ImageUrl = "images/teams/" & dr.GetString(5)
tdHimage = New TableCell
tdHimage.Controls.Add(hImage)
tr.Controls.Add(tdHimage)

td3 = New TableCell
rbList.DataValueField = dr.GetInt32(7)
rbList.Items.Add(New ListItem(dr.GetString(3)))
td3.Controls.Add(rbList)
tr.Controls.Add(td3)

'add all controls to the table
tblPlayGames.Controls.Add(tr)

Loop


The problem is that I need to display images in the cells that
correspond to the data being displayed so just populating a
RadioButtonList won't work and I can't seem to display one radio button
per table cell. The code above displays all radio buttons in one cell.

Any ideas anyone?

Thanks
Rob
 

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,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top