radiobutton validation

Carlos's Avatar, Join Date: Dec 2008
Contributor
Hi! can anyone tell me how can i apply validation that one of the radio button must be selected among three radio buttons.

It is quite easy to handle it through radiobuttonlist but the format appear in list.

Please provide code in C#.

thanx
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
If you make one selected then there is no way user can go without making a selection.
Carlos's Avatar, Join Date: Dec 2008
Contributor
Yes, but i want that none of them should be selected, and the validation enforce user to select any one by himself.
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Check for the value of them and atleast should be one.
SaswatPadhi's Avatar, Join Date: May 2009
~ Б0ЯИ Τ0 С0δЭ ~
Like :

Code: C#
bool flag = false;

flag = flag || radiobutton1.Checked;
flag = flag || radiobutton2.Checked;
flag = flag || radiobutton3.Checked;

if( flag )
{
      // continue execution
}
else
{
      // prompt user to select a radiobutton
}

Last edited by SaswatPadhi; 12Jun2009 at 18:21..