I'm having some problems getting a cookie set on a button click. Here is my
function:
Private Sub buttonSaveSettings_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles buttonSaveSettings.Click
'set the cookie for skipLinks
dim skipLinksSetting as String =
radioButtonListSkipLinks.SelectedItem.Value.tostri ng
dim cookieMJBskipLinkSettings as new HttpCookie("MJBskipLinkSettings")
if skipLinksSetting = "show" then
cookieMJBskipLinkSettings.value = "show"
else
cookieMJBskipLinkSettings.value = "hide"
end If
cookieMJBskipLinkSettings.Expires = DateAdd(DateInterval.Year, 1, now)
Response.Cookies.Add(cookieMJBskipLinkSettings)
End Sub
Anyone see any errors in the above logic/syntax?
The problem seems to be that it always grabs the 'show' value from the
options list. There are two options, one with a value of 'show' and one with
a value of 'hide'. Even if I select 'hide' then trigger the button click, it
appears to be set to 'show'. The asp control is set as such:
<asp:RadioButtonList id=radioButtonListSkipLinks runat="server" >
<asp:ListItem Value="show">Show Skip Links</asp:ListItem>
<asp:ListItem Value="hide">Hide Skip Links</asp:ListItem>
</asp:RadioButtonList>
I'm completely stumped on this one. I really could use a second (third,
fourth, etc.) set of eyes looking at this. ;o)
-Darrel