473,387 Members | 1,624 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,387 software developers and data experts.

Accessing checkbox properties in a repeater control

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>


Expand AllCollapse All
Jun 8 '06 #1
0 2238

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...
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...
2
by: Imran Aziz | last post by:
Hello All, I have added html checkboxes in each row of the repeater control that I draw on the page. Now when I wan to find out if the check boxes have been checked or not, I cannot seem to access...
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...
8
by: Alan Silver | last post by:
Hello, I have a repeater that has code like this... <ItemTemplate> <asp:CheckBox ID="chkDelete" Text="" RunAt="server"/> .... other stuff goes here </ItemTemplate> There is a button below...
2
by: RichardH | last post by:
Hi, I have x number of table rows that all should have a checkbox and a dropdownlist on each row. The checkbox could be checked and the dropdown should contain y number of values that are...
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...
5
by: c_shah | last post by:
using VB.net (2005) ASP.net 2.0 I have a repeater control with the item template, in the item template I have two checkboxes How to capture event When user checks the checkboxes? What event...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.