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
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