javascript - after removing radio button selected value from js in aspx.cs selected value presists -
i have asp radio button list control below:
<asp:radiobuttonlist id="radio2" runat="server" enableviewstate="false"> <asp:listitem text="yes" value="0"></asp:listitem> <asp:listitem text="no" value="1" selected="true"></asp:listitem> </asp:radiobuttonlist> <asp:button id="btnsubmit" runat="server" text="submit" onclick="btnsubmit_click" />
when page loads on browser select yes option radio. console remove checked property of this:
$("#radio2 input[type='radio']").prop("checked",false);
now if try access radio button list on click of button submit below
protected void btnsubmit_click(object sender, eventargs e) { foreach (listitem itemrow in radio2.items) { if (itemrow.selected) { } } }
here yes itemrow got selected value true while should false.
what requirement ? please explain properly.
itemrow got selected value true because,only page load time clearing checked property in script. in design written
"<asp:listitem text="no" value="1" selected="true"></asp:listitem>
"
thats why takes default value of radiobutton list. remove tht selected="true" not take default value.
Comments
Post a Comment