Link to home
Start Free TrialLog in
Avatar of HawaiiDragon
HawaiiDragon

asked on

Validate Radio button lists and Check box lists C#

Hello Experts,
 I am trying to validate that selections have been made on Radio button lists and check box list controls and I am banging my head against the wall.

This is my code and I have no idea how to make it work….. HELP

  if (RBLType.SelectedValue = null)
        { pnlwarning.Visible = true;}
        else
        { pnlwarning.Visible = false; }

        if (CBLStatus != checked)
        {pnlwarning.Visible = true;}
        else
        {pnlwarning.Visible = false;}
ASKER CERTIFIED SOLUTION
Avatar of jagssidurala
jagssidurala
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of HawaiiDragon
HawaiiDragon

ASKER

-      

So would I put it in the head section of the page before the content section? And How would I call it I have included the two controls in HTML


<%@ Page Language="C#" MasterPageFile="~/MasterPage2.master" AutoEventWireup="true" CodeFile="enroll2.aspx.cs" Inherits="enroll2" Title="Untitled Page" %>
<head>


</head>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


<p>
<asp:RadioButtonList ID="RBLType" runat="server">
            <asp:ListItem Value="275">Student ($275)</asp:ListItem>
            <asp:ListItem Value="816.50">Student &amp; Spouse ($816.50)</asp:ListItem>
            <asp:ListItem Value="816">Student &amp; Children ($816)</asp:ListItem>
            <asp:ListItem Value="1159">Student, Spouse &amp; Children ($1159)</asp:ListItem>
        </asp:RadioButtonList>
</p>



  <p>Please mark any of the following that apply to you:&nbsp;<asp:CheckBoxList
            ID="CBLStatus" runat="server" TextAlign="Right"  Width="299px">
    <asp:ListItem>Full-time Residential Student</asp:ListItem>
    <asp:ListItem>F-1 International Status</asp:ListItem>
    <asp:ListItem>Athlete</asp:ListItem>
    <asp:ListItem>Nursing</asp:ListItem>
    <asp:ListItem>Other</asp:ListItem>
    </asp:CheckBoxList>
    </p>
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks all