RadioButtonList

A

anonymous

Maybe you can help me with the following logic I am trying
to accomplish.
My RadioButtonList is in datagrid <EditItemTemplate>
column
If my session in empty I have this code:

Private Sub dgData_OnItemDataBound.....
If Not rbList Is Nothing Then
Dim index As String = ""
index = DataBinder.Eval
(e.Item.DataItem, "list")
If index = "12" Then
rbList .SelectedIndex = 0
ElseIf index = "11" Then
rbList .SelectedIndex = 2
Else
rbList .SelectedIndex = -1
End If
End If
End If

If in session I have row.Item("List") = "11" then remove
item- >rbList.Items.RemoveAt(1).

Private Sub dgData_OnItemDataBound.....
If (dgData.EditItemIndex = e.Item.ItemIndex) Then
Dim rbList As RadioButtonList = CType(e.Item.FindControl
("rbList"), RadioButtonList)
Dim row As DataRow
Dim i As String
If rbList Is Nothing = False Then
For Each row In Session(pageName).Tables
(0).Rows
If row.Item("List") = "11" Then
rbList.Items.RemoveAt(1)
rbList.Items.RemoveAt(1)
End If

Next
It is working fine in cases above and when I adding a new
row, but
If I am editing the existing row where I had items(1) at
the time when row was added
to the session this item I need to dispay that items.
That is where I get confused.
Since I remove that item....

In both cases the grid in edit mode.
 

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,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top