checkbox list ,requried field validator
i have code
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"
type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#<%= btnTest.ClientID %>').click(function () {
var checkedControls = $('#<%= CheckBoxList1.ClientID %>').find('input:checkbox:checked');
if (checkedControls.length > 0) {
alert('Valid');
}
else {
alert('Please select atleast one checkbox');
}
return false;
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:CheckBoxList RepeatColumns="3" RepeatDirection="Horizontal" ID="CheckBoxList1"
runat="server">
<asp:ListItem Value="1">Cutomer Broker</asp:ListItem>
<asp:ListItem Value="2">N.V.O.C.C</asp:ListItem>
<asp:ListItem Value="3">Hauloiers</asp:ListItem>
<asp:ListItem Value="4">Air Freight</asp:ListItem>
<asp:ListItem Value="5">Sea Freight</asp:ListItem>
<asp:ListItem Value="6">Supply Chain Management</asp:ListItem>
<asp:ListItem Value="7">Groupage Services</asp:ListItem>
<asp:ListItem Value="8">Project Cargo</asp:ListItem>
<asp:ListItem Value="9">Ware House Operator</asp:ListItem>
</asp:CheckBoxList>
<asp:Button ID="btnTest" runat="server" Text="Test" />
</form>
</body>
</html>
this code check work fine ,but i have radio button (yes and no) on same .aspx page .if yes(0) and no (1).
i need to check if yes is selected (certain palceholder open that have some controls) i already did .but teh problem is i need to check yes is selected or not for radio buton.
please help me.any urgent reply is higly appreciaed
erum
Junior Poster in Training
72 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
i handled most of the stuff now but the problem is how to find placeholder via jquery .
<div runat=server visible=false id="hotel_div" style="border:dotted 1px black;">
<asp:PlaceHolder ID="PlaceHolder3" runat="server" Visible=false > <Strong>Hotel Requirement</Strong>
<asp:CheckBoxList ID="hotel_requirement_Types" RepeatColumns=3 RepeatDirection=Horizontal runat="server">
<asp:ListItem Text="Deluxe Platinum" Value=0></asp:ListItem>
<asp:ListItem Text="Deluxe Gold" Value=1></asp:ListItem>
<asp:ListItem Text="Deluxe Silver" Value=2></asp:ListItem>
</asp:CheckBoxList>
<asp:CheckBox ID="CheckBox2" Text="Single Room(s)" runat="server" />
<asp:CheckBox ID="CheckBox3" Text="Number of Rooms" runat="server" />
<asp:CheckBox ID="CheckBox4" Text="Double Room(s)" runat="server" />
<asp:CheckBox ID="CheckBox5" Text="Number of Rooms" runat="server" />
</asp:PlaceHolder>
</div>
erum
Junior Poster in Training
72 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0