473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Accessing the properties of a checkbox within a repeater

I have a repeater control that contains a HeaderTemplate and an ItemTemplate.
Each item contains a checkbox with an ID of chkReconciled, and the header
contains a single checkbox with an ID of chkAll. I simply want to have
chkAll be checked if every item in the repeater has its checkbox checked. In
the code behind page, I can access the checked property of chkReconciled by
doing the following:

Dim CurrentCheckBox As CheckBox
CurrentCheckBox = rptDeposits.Items(I).FindControl("chkReconciled")

Then I can check if CurrentCheckBox.checked is true. That works fine.
However, I haven't been able to set the checked property for chkAll. Since
it isn't part of the items, I have been trying the following:

Dim CheckAll As CheckBox
CheckAll = rptDeposits.FindControl("chkAll")
CheckAll.Checked = True

However, when I try to set the checked property, I get an exception saying,
"Object reference not set to an instance of an object." I've experimented
with a dozen different ways of setting the checked property of CheckAll, to
no avail. Can anyone set me on the right path?! I'm pasting the ASPX code
for the repeater below.

Thanks!
Keith

<%@ OutputCache Location="None" Duration="1" VaryByParam="None" %>
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="Bank_recon_deposit.aspx.vb"
Inherits="IAMVFO_DEV.Bank_recon_deposit"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Bank_recon_deposit</title>
<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<LINK href="Styles.css" type="text/css" rel="stylesheet">
</HEAD>
<BODY onresize="return Height();"
onload="setTimeout('SessionTimeout()',1080000); return Height();"
class="background">
<!--<p class="sectionHeader">Bank Reconciliation</p>-->
<form id="frmBankReconDep" method="post" runat="server">
<TABLE id="Table1" cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD class="Report_HeaderColor" style="FONT-WEIGHT: bold; FONT-SIZE:
12pt">Bank
Reconciliation
<asp:button id="btnBack" runat="server" Text="<
Back"></asp:button> <asp:button id="btnCancel" Text="Cancel and Lose Changes"
runat="server" Width="146"></asp:button>
<asp:button id="btnSave" Text="Save and Finish Later" runat="server"
Width="146px"></asp:button>
<asp:button id="btnNext" runat="server" text="Next >"
DESIGNTIMEDRAGDROP="65"></asp:button></TD>
</TR>
</TABLE>
<table cellSpacing="1" cellPadding="3" style="FONT-SIZE: 11pt; WIDTH:
100%">
<tr>
<TD class="Report_HeaderColor" align="middle">
<asp:Button id="btnCleared" runat="server" Text="Total Cleared
Deposits" Width="141px"></asp:Button></TD>
<td class="Report_HeaderColor" style="WIDTH: 175px">
<asp:Label id="lblAmount" runat="server"
Font-Size="11pt"></asp:Label></td>
<td rowSpan="2" class="Report_HeaderColor" style="FONT-SIZE: 11pt">
Please check-off the deposits that have cleared the bank, as listed on
your
bank statement.</td>
</tr>
</table>
<asp:repeater id="rptDeposits" runat="server">
<HeaderTemplate>
<div id="divTransHeader" style="VISIBILITY: hidden">
<table id="tblTransHeader" border="0" cellspacing="0"
class="HeaderTable">
<colgroup class="ShadeColHeaderDark">
<col id="colHeader1" align="center">
<col id="colHeader2" align="center">
<col id="colHeader3" align="center">
<col id="colHeader4" align="center">
<col id="colHeader5" align="center">
<col id="colHeader6" align="center">
<col id="colHeader7" align="center">
<col width="*">
</colgroup>
<tr class="TableHeaders">
<td id="tblTransHeader1_0">
<asp:label text="R/C" id="lblReconciled"
Runat="server"></asp:label></td>
<td id="tblTransHeader1_1">
<asp:LinkButton id="lnkSortDate" CausesValidation="false"
OnCommand="SortData" CommandArgument="transdate" text="Date" Runat="server"
ForeColor="#000000"></asp:LinkButton></td>
<td id="tblTransHeader1_2">
<asp:LinkButton id="lnkSortNumber" CausesValidation="false"
OnCommand="SortData" CommandArgument="depositID" text="Number" Runat="server"
ForeColor="#000000"></asp:LinkButton></td>
<td id="tblTransHeader1_3" colspan="2">
<asp:LinkButton id="lnkSortDesc" CausesValidation="false"
OnCommand="SortData" CommandArgument="TransDesc" text="Description"
Runat="server" ForeColor="#000000"></asp:LinkButton></td>
<td id="tblTransHeader1_4">
<asp:LinkButton id="lnkSortPayType" CausesValidation="false"
OnCommand="SortData" CommandArgument="paymenttype" text="Payment Type"
Runat="server" ForeColor="#000000"></asp:LinkButton></td>
<td id="tblTransHeader1_5">
<asp:LinkButton id="lnkSortReceipt" CausesValidation="false"
OnCommand="SortData" CommandArgument="receipt" text="Deposit" Runat="server"
ForeColor="#000000"></asp:LinkButton></td>
<td id="tblTransHeader_SCROLL_BAR_HACK_COLUMN_1"> </td>
</tr>
<tr class="TableHeaders">
<td id="tblTransHeader2_0" style="BORDER-TOP: white 2px solid">All
<asp:CheckBox ID="chkAll" AutoPostBack=True
OnCheckedChanged="CheckAll" Runat="server" EnableViewState="true"/></td>
<td id="tblTransHeader2_1"> </td>
<td id="tblTransHeader2_2"> </td>
<td id="tblTransHeader2_3" style="BORDER-TOP: white 2px solid">
<asp:LinkButton id="lnkSortCat" CausesValidation="false"
OnCommand="SortData" CommandArgument="category" text="Category"
Runat="server" ForeColor="#000000"></asp:LinkButton></td>
<td id="tblTransHeader2_4" style="BORDER-TOP: white 2px solid">
<asp:LinkButton id="lnkSortSubCat" CausesValidation="false"
OnCommand="SortData" CommandArgument="subCategory" text="Sub-Category"
Runat="server" ForeColor="#000000"></asp:LinkButton></td>
<td id="tblTransHeader2_5"> </td>
<td id="tblTransHeader2_6"> </td>
<td id="tblTransHeader_SCROLL_BAR_HACK_COLUMN_2"> </td>
</tr>
</table>
</div>
<DIV id="divTransBody" style="VISIBILITY: hidden; OVERFLOW: auto;
WIDTH: 100%; HEIGHT: 180px">
<table border="0" cellspacing="0" id="tblTransBody" width="100%">
<colgroup class="ShadeColHeaderDark">
<col width="80" id="tblTransBody1" align="center">
<col width="80" id="tblTransBody2" align="center">
<col width="100" id="tblTransBody3" align="center">
<col width="155" id="tblTransBody4" align="center">
<col width="145" id="tblTransBody5" align="center">
<col width="100" id="tblTransBody6" align="center">
<col width="200" id="tblTransBody7" align="center">
</colgroup>
</HeaderTemplate>
<ItemTemplate>
<tr class="Shade_Trans_light">
<td>
<asp:CheckBox ID="chkReconciled" Checked
=<%#Container.DataItem("Reconciled")%> Runat="server" />
<asp:Label ID="lblDepositId" Runat=server Visible=false
text=<%#Container.DataItem("DepositID")%>/></td>
<asp:Label ID="lblType" Runat=server Visible=false
text=<%#Container.DataItem("Type")%>/></td>
<td><%# Format(Container.DataItem("TransDate"), "MM/dd/yyyy") %></td>
<td><%# Container.DataItem("Number")%></td>
<td colspan="2">
<asp:Label ID="lblTransDesc" text=<%#
Container.DataItem("TransDesc")%> Runat=server visible=true>
</asp:Label>
</td>
<td>
<asp:Label ID=lblPayType text=<%# Container.DataItem("PaymentType")%>
Runat=server visible=true>
</asp:Label>
</td>
<td>
<asp:Label ID=lblReceipt text=<%# Container.DataItem("Receipt") %>
runat=server>
</asp:Label></td>
</tr>
<tr class="Shade_Trans_dark">
<td colspan="3">
<asp:Label ID="lblAdjustTrans" text=<%#
Container.DataItem("AdjustTransaction")%> runat=server>
</asp:Label>
<asp:Label ID="lblBatchID" Runat=server Visible=false
text=<%#Container.DataItem("payroll_ind")%>/>
</td>
<td>
<asp:Label ID="lblCategory" text=<%# Container.DataItem("Category")%>
Runat=server visible=true>
</asp:Label></td>
<td>
<asp:Label ID=lblSubCategory text=<%#
Container.DataItem("SubCategory")%> Runat=server visible=true>
</asp:Label></td>
<td></td>
<td colspan="2">
<asp:LinkButton ForeColor ="#3333ff" CausesValidation=false
ID="lnkAdjust" CommandArgument=<%# Container.DataItem("DepositID")%>
OnCommand="lnkAdjust_Click" Runat="server">
</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
<SeparatorTemplate>
<tr>
<td colspan="10" height="2" bgcolor="black" style="BORDER-RIGHT: white
1px solid; BORDER-LEFT: white 1px solid;"></td>
</tr>
</SeparatorTemplate>
<FooterTemplate>
</table> </div>
</FooterTemplate>
</asp:repeater>
<asp:button id="BtnRefresh" CausesValidation="false" Runat="server"
Text="refresh"></asp:button>
<input type="hidden" id="hdnlnkAdjust" runat="server"
NAME="hdnlnkAdjust"> <input type="hidden" id="hdnCancel" runat="server"
NAME="hdnCancel">
<asp:DataGrid id="DataGrid1" runat="server"></asp:DataGrid>
</form>
<script language="javascript" src="AlignGridHeaders.js"></script>
<script language="javascript">
<!--
Resizecolumns(tblTransHeader, tblTransBody, divTransBody, 7);
divTransHeader.style.visibility = "visible";
divTransBody.style.visibility = "visible";

//-->
</script>
<script language="javascript">
<!--
//4/11/05-Wrote this function, and added the onload & onresize events
to the <body> tag,
// to resize the transaction log based on screen resolution.
function Height()
{if ((screen.width==1024) && (screen.height==768))
return divTransBody.style.height = 402;
else if ((screen.width==800) && (screen.height==600))
return divTransBody.style.height = 192;}

// 03/06/2006-Added the SessionTimeout() function to warn a user of a
timeout.
function SessionTimeout()
{
alert("Your session will Timeout in 2 minutes!\n Any changes will be
lost if that happens.\n Click NEXT or SAVE AND FINISH LATER on the page to
save your changes.");
}
//-->
</script>
</FORM>
</BODY>
</HTML>

Jun 6 '06 #1
0 2767

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: DonRex | last post by:
Hello all! I couldn't find a web application-newsgroup for ASP.NET, so I'm sorry if this is the wrong forum! Synopsis: In my webform I have 3 nested repeaters: rpWeeks ----- rpTime
2
by: Thomas R | last post by:
Is is possible? In VS.NET 2003, Binding data to the repeater is easy, but when I try to add an ASP:checkbox to the .aspx page, the designer won't recognize it, hence the code view doesn't allow...
2
by: Mark | last post by:
I am attempting to build a repeating list using a repeater control. I want to add a checkbox to each item (line) and 'Select All' and 'Clear All' buttons. I have figured out how to do this...
4
by: John Holmes | last post by:
I'm using data to rename some web controls on a form that uses a repeater contol and so it can have mulitple instances of the same control set. The controls get renamed (thanks to Steven Cheng's...
3
by: Jack Turnbull | last post by:
Hi, I have a Checkbox in a Repeater set to AutoPostBack = true. I have pointed OnCheckedChanged to a Sub but it doesn't fire. If I move the checkbox out of the Repeater it fires! Any ideas? Thanks
2
by: Alan Silver | last post by:
Hello, I have a repeater with a list of products in it. Each item in the repeater has a checkbox, allowing the product to be selected. When a link button is clicked, I want to loop through the...
2
by: Andrew | last post by:
Hi, I have a problem capturing the checkboxes that are checked, I get false irrespective of wether they are checked or not. I have gone thru the sample code on this forum, but they dun seem to...
2
by: Ceema M via DotNetMonster.com | last post by:
Hello all, I have a nested repeater, which displays categories(parent repeater) and corresponding subcategories(child repeater). Both repeaters have checkboxes. When I check category checkbox...
0
by: Keith | last post by:
I have a repeater control that contains a HeaderTemplate and an ItemTemplate. Each item contains a checkbox with an ID of chkReconciled, and the header contains a single checkbox with an ID of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.