Home All Groups Group Topic Archive Search About
Author
29 Mar 2005 8:32 PM
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

Author
30 Mar 2005 2:04 PM
Jason Bentley
Well, you are not looping through the checkbox controls and you are not
creating new checkboxes so I would guess that is the problem.

Jason Bentley
http://geekswithblogs.net/jbentley
Author
30 Mar 2005 2:40 PM
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