Reputation: 89
Here is my radio button list
<asp:RadioButtonList ID="geo_radio" runat="server" RepeatDirection="Vertical" RepeatLayout="Table" >
<asp:ListItem Value="state">State</asp:ListItem>
<asp:ListItem Value="county">County</asp:ListItem>
<asp:ListItem Value="county subdivision">County Subdivision</asp:ListItem>
<asp:ListItem Value="place">Place</asp:ListItem>
<asp:ListItem Value="micropolitan">Micropolitan</asp:ListItem>
<asp:ListItem Value="combined statistical area">Combined Statistical Area</asp:ListItem>
<asp:ListItem Value="congressional districts">Congressional Districts</asp:ListItem>
<asp:ListItem Value="Custom Region">Custom Region</asp:ListItem>
</asp:RadioButtonList>
I am able to retrieve selected value using
$('#<%=geo_radio.ClientID%>').find('input[type="radio"]').click(function () {
var selectedValue = $(this).val();
});
In my .aspx page I have a method FetchData(). I am calling this function on page load
protected void Page_Load(object sender, EventArgs e)
{
FetchData();
}
How can I send selected radio button value to FetchData() function.
Upvotes: 0
Views: 559
Reputation: 474
add selectedValue to hidden field and get hidden field value to code behind and pass it to your function
$("#hid").val(selectedValue);
hid is the id or your hidden feild
FetchData(hid.value);
Upvotes: 0
Reputation: 7566
You can use a hidden field, set the value of asp hidden field, or you can use request object to retrieve the value.
Upvotes: 1