Logic

A

anonymous

I need some help. I have 2 loops. One to find a
RadioButtonList in datagrid and
second in Session("Answ"). I am trying to assing value
from Session("Answ") to
RadioButtonList.selectedValue. However the value which is
selected is the last value in
session. Where did I mixed the logic.Thanks
Dim Answer As Answers
Dim dgItem As DataGridItem
For Each dgItem In dataGrid1.Items
If dgItem.ItemType =
ListItemType.AlternatingItem Or dgItem.ItemType =
ListItemType.Item Then
Dim rbl As RadioButtonList = CType
(dgItem.FindControl("rbList"), RadioButtonList)
For Each Answer In Session("Answ")

Dim aValue As String = Answer.rAnswer
rbList.SelectedValue = aValue

Next
End If
Next
 
A

anonymous

Here is my code. I can't see what I am doing incorrect. I
am honestly stuck...
Dim Answer As Answers
Dim dgItem As DataGridItem
For Each dgItem In dataGrid1.Items
If dgItem.ItemType =
ListItemType.AlternatingItem Or dgItem.ItemType =
ListItemType.Item Then
Dim rbl As RadioButtonList = CType
(dgItem.FindControl("rbList"), RadioButtonList)
For Each Answer In Session("Answ")

Dim aValue As String = Answer.rAnswer
rbList.SelectedValue = aValue

Next
End If
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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top