radiobuttonlist and asp.net2.0
-
<asp:RadioButtonList ID="rdDateSelection" visible="true" AutoPostBack="true" runat="server" RepeatDirection="vertical" > <asp:ListItem Value="Today">Today</asp:ListItem> <asp:ListItem Value="FromToDate">From </asp:ListItem> </asp:RadioButtonList> through javascripting i want ot find out which radio the user has clicked .
-
<asp:RadioButtonList ID="rdDateSelection" visible="true" AutoPostBack="true" runat="server" RepeatDirection="vertical" > <asp:ListItem Value="Today">Today</asp:ListItem> <asp:ListItem Value="FromToDate">From </asp:ListItem> </asp:RadioButtonList> through javascripting i want ot find out which radio the user has clicked .
var value=rdDateSelection.Options[rdDateSelection.selectedIndex].value; //Check value if(value=="Today") //do something here else //here
please don't forget to vote on the post that helped you.
-
var value=rdDateSelection.Options[rdDateSelection.selectedIndex].value; //Check value if(value=="Today") //do something here else //here
please don't forget to vote on the post that helped you.
-
<asp:RadioButtonList ID="rdDateSelection" visible="true" AutoPostBack="true" runat="server" RepeatDirection="vertical" > <asp:ListItem Value="Today">Today</asp:ListItem> <asp:ListItem Value="FromToDate">From </asp:ListItem> </asp:RadioButtonList> through javascripting i want ot find out which radio the user has clicked .
-
<asp:RadioButtonList ID="rdDateSelection" visible="true" AutoPostBack="true" runat="server" RepeatDirection="vertical" > <asp:ListItem Value="Today">Today</asp:ListItem> <asp:ListItem Value="FromToDate">From </asp:ListItem> </asp:RadioButtonList> through javascripting i want ot find out which radio the user has clicked .
Try this it is working fine function getCheckedRadio() { var radioButtons = document.getElementsByName("rblCustomer"); for (var x = 0; x < radioButtons.length; x ++) { if (radioButtons[x].checked) { alert("You checked " + radioButtons[x].id + " which has the value " + radioButtons[x].value); } } }
Today FromToDate :-\
-
Try this it is working fine function getCheckedRadio() { var radioButtons = document.getElementsByName("rblCustomer"); for (var x = 0; x < radioButtons.length; x ++) { if (radioButtons[x].checked) { alert("You checked " + radioButtons[x].id + " which has the value " + radioButtons[x].value); } } }
Today FromToDate :-\
hi, Try this... its working function mytest() { var rdolist = document.getElementsByName("RadioButtonList1"); if (rdolist[1].checked) alert("1"); if (rdolist[2].checked) alert("2"); if (rdolist[3].checked) alert("3"); return true; } protected void Page_Load(object sender, EventArgs e) { RadioButtonList1.Attributes.Add("onclick", "javascript: return mytest();"); }
sandesh