I wonder if someone has stumbled upon this problem.
I have two asp:RadioButtonList
controls on the same page. I gave them both a click event via jQuery (see below).
Default.aspx:
<asp:RadioButtonList ID = "rad_banner_type" runat = "server" >
<asp:ListItem Value ="Picture" Text ="Image(.jpg .png .bpm)" />
<asp:ListItem Value ="Code" Text ="Code" />
<asp:ListItem Value ="Flash" Text ="Flash(.swf)" />
</asp:RadioButtonList>
jQuery:
function pageLoad() {
//LINK TYPE
$("#<%= rad_link_type.ClientID%>").change(function () {
var rad_link_type = $("input[@name=<%=rad_link_type.ClientID%>]:radio:checked").val();
switch (rad_link_type) {
case "Email":
//Do Something
break;
case "PDF":
//Do Something
break;
case "Website":
//Do Something
break;
default:
//Do Something
break;
}
});
//PICTURE TYPE
$("#<%= rad_banner_type.ClientID%>").click(function () {
var rad_banner_type = $("input[@name=<%=rad_banner_type.ClientID%>]:radio:checked").val();
switch (rad_banner_type) {
case "Picture":
//Do Something
break;
case "Code":
//Do Something
break;
case "Flash":
//Do Something
break;
default:
//Do Something
break;
}
});
}
My problem is that when I click on the first RadioButtonList
the selected value is correct, but as soon as I click on the second RadioButtonList
the selected value stays the same as the first selected value.
How can I fix this problem?
I found the solution.
I just need to change the way i search for the jQuery selected value instead of:
I used: