Can anybody please help me to resolve this simple issue..How to clear the selection of a radiobuttonlist after a form submission. i need to use it in my asp.net web application. when a user clicks on the clear button i need to clear the selection of radiobutton list.Thanks in advance
RadioButtonList control is a collection of ListItems. To clear one radio button in the control you need to use Index for that particular item. To clear all radio buttons in the control, there is a method "ClearSelection()". //To Unselect First Item RadioButtonList1.
To remove all the list items from the RadioButtonListcontrol, use the following code: RadioButtonList1. Items. Clear();
Find the button in the "Components" list and drag it onto the form. While the button is still selected, go to the "Properties" window on the bottom right of your screen and change its text property to read: "Clear Radio Buttons."
An asp:radiobuttonlist creates a group of radiobuttons that ensures when one is selected, the others are deselected whereas asp:radiobutton is not within a group and therefore cannot be deselected by clicking other radio buttons.
You could - either set myrbList.SelectedIndex = -1, - or foreach through its .Items and set each item.Selected = false
RadioButtonList1.ClearSelection();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With