[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Radio buttton validation HELP

Posted on 2006-04-29
6
Medium Priority
?
304 Views
Last Modified: 2008-02-01


I have a grid that has YES and NO HTML radio buttons for each row.  I need to make sure the user selects at least one.

Each row has a unique radion button like:

Row 1
rcount = 1
  <input type="radio" name="Radio(rcount)" value="Yes />
<input type="radio" name="Radio(rcount)" value="No />

 rcount + 1

Row 2
  <input type="radio" name="Radio(rcount)" value="Yes />
<input type="radio" name="Radio(rcount)" value="No />

Thanks


0
Comment
Question by:cat4larry
  • 2
3 Comments
 
LVL 6

Expert Comment

by:nehaya
ID: 16572873
Use CustomValidation..

Regards,
Nehaya
0
 

Author Comment

by:cat4larry
ID: 16573626
I'm creating the Form in the VB code behind file, do you have an example of how I can use customvalidation.  Here is what my code actually looks like.


  If DataSet.Tables(1).Rows(rCount)("NewContractNo") <> 0 Then
                        sBookingGrid &= "<td rowspan=""2"" height=""24"" class=""ChartTH"" style=""padding-left:10px "" bgColor=""" & sAltAvailGridColor & """><div align=""center"">Reserved</div>" & vbCrLf
                    Else
                        sBookingGrid &= "<td height=""24"" class=""ChartTH"" style=""padding-left:10px "" bgColor=""" & sAltAvailGridColor & """><input name=""rdRenew" & (LCount) & """ type=""radio"" class=""forminput""  style=""border:0px; width:15px;background-color:" & sAltAvailGridColor & """" & " value=""1"" onclick=""calculateTotal();"">" & "<input type=""hidden"" name =""unit"" value=""" & DataSet.Tables(1).Rows(rCount)("pkSalesOrderSellingUnitID") & """> " & vbCrLf
                        sBookingGrid &= "&nbsp;Yes" & "</td>"  '& RenewStatus

                        'Garb = DataSet.Tables(1).Rows(rCount)("pkSalesOrderSellingUnitID")
                    End If
                    sBookingGrid &= "<td height=""24"" rowspan=""2"" class=""ChartTH"" bgColor=""" & sAltAvailGridColor & """><div align=""center"">" & DataSet.Tables(1).Rows(rCount)("ContractNo") & "</div></td>" & vbCrLf
                    sBookingGrid &= "<td rowspan=""2""  class=""ChartTH"" bgColor=""" & sAltAvailGridColor & """><div align=""center"">" & DataSet.Tables(1).Rows(rCount)("UnitInterval") & "</div></td>" & vbCrLf
                    sBookingGrid &= "<td rowspan=""2""  class=""ChartTH"" bgColor=""" & sAltAvailGridColor & """><div align=""center"">" & FormatCurrency(DataSet.Tables(1).Rows(rCount)("ResidualRight"), 0) & "</div></td>" & vbCrLf
                    sBookingGrid &= "<td rowspan=""2""  class=""ChartTH"" bgColor=""" & sAltAvailGridColor & """><div align=""center"">" & FormatCurrency(PublicPrice, 0) & "</div></td>" & vbCrLf
                    sBookingGrid &= "<td rowspan=""2""  class=""ChartTH"" bgColor=""" & sAltAvailGridColor & """><div align=""center"">" & FormatCurrency(DataSet.Tables(1).Rows(rCount)("PurchasePrice"), 0) & "</div></td>" & vbCrLf
                    sBookingGrid &= "<td rowspan=""2""  class=""text"" bgColor=""" & sAltAvailGridColor & """><strong><div align=""center"">" & FormatCurrency(DataSet.Tables(1).Rows(rCount)("TotalInvestment"), 0) & "</div></strong><input name=""rdRenewTotal" & (LCount) & """ id=""rdRenewTotal" & (LCount) & """ type=""hidden"" value=" & FormatCurrency(DataSet.Tables(1).Rows(rCount)("TotalInvestment"), 0) & " ></td>" & vbCrLf
                    sBookingGrid &= "</tr>" & vbCrLf
                    sBookingGrid &= "<tr>" & vbCrLf
0
 
LVL 6

Accepted Solution

by:
nehaya earned 2000 total points
ID: 16573783
[Are you using 1.1 or 2.0 ?]

First, DO YOU WRITE YOUR OWN GRID?!!
- Why you didn't use GridView? Or DataList?
// examples:
Video of 'Scott to do list':
  Page: http://atlas.asp.net/Default.aspx?tabid=47
  File: http://download.microsoft.com/download/8/5/8/85803fdd-fe9a-4783-ab37-e0c565172ffd/asp_net_atlas.wmv

- For validation, but requeiredValidator to test the radiogroup
BETTER SOLUTION, put the first radiobutton alawys check!

-OR from Javascript, see this page:
http://www.questionpoint.org/support/documentation/templates/requiringquestionfields.html#rb_val
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question