Hi
I am trying to check whether checkboxes are checked in my user control. I
have problems getting the right reference to the checkboxes:
<%@ Page language="c#" Codebehind="WebForm2.aspx.cs"
AutoEventWireup="false" Inherits="javascriptusercontrol.WebForm2" %>
<%@ Register TagPrefix="uc1" TagName="WebUserControl1"
Src="WebUserControl1.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm2</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<script>
function checkit2(field)
{
var teller=0;
for (i = 0; i < 2; i++)
{
if (field[i].checked == false)
{
teller = teller+1;
}
}
if (teller==2)
{
alert("no good");
}
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<input type="button" name="c5"
onclick="checkit2(document.Form1['uc:list'])" style="Z-INDEX: 101; LEFT:
248px; WIDTH: 128px; POSITION: absolute; TOP: 16px; HEIGHT: 24px"
value="check if checked">
<uc1:WebUserControl1 id="WebUserControl11"
runat="server"></uc1:WebUserControl1>
</form>
</body>
</HTML>
usercontrol code:
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="WebUserControl1.ascx.cs"
Inherits="javascriptusercontrol.WebUserControl1"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<asp:CheckBox ID="cb1" Runat="server" name="list"></asp:CheckBox>
<asp:CheckBox ID="cb2" Runat="server" name="list"></asp:CheckBox>
what could be wrong?
ch Beffmans