Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

Validator for radio button group

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
M. Ali Qureshi - 10 Dec 2007 14:02 GMT
Hi,

I have 3 radio buttons on my page with different IDs, but they are grouped
with name "Q1".

I need to add some kind of validator on them so that user must have to
select one of them.

I cannot use radiobuttonlist, its because these 3 radiobuttons have to be
placed in seperate table cells.

Could anyone help me on how i can acheive this?

Thanks in advance.
bruce barker - 10 Dec 2007 17:17 GMT
there a number of ways to do this. use getElementsByTagName, and checking the
name, but the simplest is to add the checkbox id to the validator

  ClientScript.RegisterExpandoAttribute(myValidator.ClientID,
     "chk1",checkbox1.ClientID);
  ClientScript.RegisterExpandoAttribute(myValidator.ClientID,
     "chk2",checkbox2.ClientID);
  ClientScript.RegisterExpandoAttribute(myValidator.ClientID,
     "chk2",checkbox2.ClientID);

then in the client validation function:

 function chkValid(oSrc, args)
 {
   var chk1 = document.getElementById(oSrc.chk1);
   var chk2 = document.getElementById(oSrc.chk2);
   var chk3 = document.getElementById(oSrc.chk3);
 }

 

-- bruce (sqlwork.com)

> Hi,
>
[quoted text clipped - 10 lines]
>
> Thanks in advance.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.