I would recommend using the RadioButtonList class if you can only
select one radiobutton at a time, then just figure out which one is
selected using the SelectedItem property, then bind based on that
logic. If you can simultaneously select both, then use a CheckBox
control. If that's not possible, then I would make a few corrections
to your code as such.
in the page load section, i would use this code
' --------------------------------------
If Not Page.IsPostBack Then
RB1.Checked = CType(Session("Checked1"), Boolean)
RB2.Checked = CType(Session("Checked2"), Boolean)
Me.sUrl = CreateStreetMap(1)
End If
' --------------------------------------
I would also modify the following OnCheckedEvents
' --------------------------------------
Private Sub RB1_CheckedChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles IncidentLinkRB.CheckedChanged
Session("Checked1") = RB1.Checked
' Session("Checked2") = Not (RB2.Checked) - commented out, session
should already have this value? if not, initialize Session with
default values
Session("checkChanged") = True
Me.sUrl = CreateStreetMap(1)
End Sub
Private Sub RB2_CheckedChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DetourLinkRB.CheckedChanged
' Session("Checked1") = Not (RB2.Checked) - commented out - session
should already have this value, if not, initialize session with default
values earlier
Session("Checked2") = RB2.Checked
Session("checkChanged") = True
Me.sUrl = CreateStreetMap(1)
End Sub
' ---------------------------------------------------------
When i say initialize earlier, i mean something in the If Not
Page.IsPostBack adding something like this
'------------------------------------------------------------
If Session("Checked1") = Nothing Then
Session("Checked1") = false
End If
If Session("Checked2") = Nothing Then
Session("Checked2") = false
End If
'------------------------------------------------
That way, you won't accidently overwrite your values if that is what
may be happening.
Let me know if you are still having problems. If needed, you can email
me the full code at darrenkopp [at] [gmail dot com] and I will look
through it more in depth.
-Darren Kopp
http://blog.secudocs.com/