Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to clear a radiobutton list after successful data insertion?

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

like image 382
Anto Augustine Avatar asked Apr 14 '12 11:04

Anto Augustine


People also ask

How do I uncheck a radio button list?

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.

How to clear radio button list in asp net?

To remove all the list items from the RadioButtonListcontrol, use the following code: RadioButtonList1. Items. Clear();

How do you clear radio buttons in Visual Basic?

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."

What is the difference between radio button and radio button list?

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.


2 Answers

You could - either set myrbList.SelectedIndex = -1, - or foreach through its .Items and set each item.Selected = false

like image 117
Dmitry Pavlov Avatar answered Oct 19 '22 23:10

Dmitry Pavlov


RadioButtonList1.ClearSelection();
like image 23
Hayu Rahiza Avatar answered Oct 19 '22 23:10

Hayu Rahiza