We help IT Professionals succeed at work.
Get Started

ASP.NET Check Box Validation

RickEpnet asked
Last Modified: 2012-06-21
I don't generally develop in ASP.NET but I am this time so be easy on me.

I am using VB and I am not developing Visual Studio.

The customer has check boxes 3 groups of them. They want at least one box checked in each group is there a way to do this?

See code for the check box grouping this might help explain.

<%@ Page Language="vb" AutoEventWireup="false" Inherits="homeh.WebForm1" CodeFile="test.aspx.vb" enableEventValidation="false" validateRequest=false%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<form runat="server">
<asp:ValidationSummary DisplayMode="BulletList" HeaderText="Please correct these Errors" ID="pagesum" runat="server" ShowMessageBox="true" ShowSummary="false" /> 
<table width="933" border="0" cellspacing="0" cellpadding="3">
                      <td colspan="2" bgcolor="#CCCCCC">solution <span class="style10">*</span></td>
                      <td width="30">&nbsp;</td>
      <td width="30">&nbsp;</td>
      <td colspan="2" bgcolor="#CCCCCC">time frame for installation <span class="style10">*</span></td>
                      <td width="30" bgcolor="#CCCCCC"><asp:CheckBox Checked="false" ID="billpay" runat="server" /></td>
                      <td bgcolor="#CCCCCC">bill pay</td>
                      <td><asp:CheckBox Checked="false" ID="internet" runat="server" /></td>
                      <td><asp:CheckBox Checked="false" ID="retail" runat="server" /></td>
                      <td width="30" bgcolor="#CCCCCC"><asp:CheckBox Checked="false" ID="asap" runat="server" /></td>
                      <td bgcolor="#CCCCCC">asap</td>
                      <td bgcolor="#CCCCCC"><asp:CheckBox Checked="false" ID="financial" runat="server" /></td>
                      <td bgcolor="#CCCCCC">financial</td>
                      <td><asp:CheckBox Checked="false" ID="music" runat="server" /></td>
                      <td><asp:CheckBox Checked="false" ID="ticketing" runat="server" /></td>
                      <td bgcolor="#CCCCCC"><asp:CheckBox Checked="false" ID="oneto3months" runat="server" /></td>
                      <td bgcolor="#CCCCCC">1 to 3 months</td>
                      <td bgcolor="#CCCCCC"><asp:CheckBox Checked="false" ID="hr" runat="server" /></td>
                      <td bgcolor="#CCCCCC">human resources</td>
                      <td><asp:CheckBox Checked="false" ID="ordere" runat="server" /></td>
                      <td>order entry</td>
                      <td><asp:CheckBox Checked="false" ID="wayfinding" runat="server" /></td>
                      <td bgcolor="#CCCCCC"><asp:CheckBox Checked="false" ID="m3months" runat="server" /></td>
                      <td bgcolor="#CCCCCC">more than 3 months</td>
                      <td bgcolor="#CCCCCC"><asp:CheckBox Checked="false" ID="informational" runat="server" /></td>
                      <td bgcolor="#CCCCCC">informational</td>
                      <td><asp:CheckBox Checked="false" ID="photo" runat="server" /></td>
                      <td><asp:CheckBox Checked="false" ID="other" runat="server" /></td>
                      <td colspan="2">quanity *                     </td>
                      <td><asp:TextBox ID="quanity" runat="server" Width="40" />
            Display="None" EnableClientScript="true"
            ErrorMessage="quanity is required " id="REQquanity" runat="server"
            Width="100%"> </asp:RequiredFieldValidator></td>
  <asp:Button runat="server" Text="Submit" id="reg" OnClick="ValidateBtn_Click"  />

Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE