473,840 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Ite ms(I).FindContr ol("chkReconcil ed")

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.Fin dControl("chkAl l")
CheckAll.Checke d = 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.


<%@ OutputCache Location="None" Duration="1" VaryByParam="No ne" %>
<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="Ban k_recon_deposit .aspx.vb"
Inherits="IAMVF O_DEV.Bank_reco n_deposit"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<title>Bank_rec on_deposit</title>
<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta content="Micros oft Visual Studio.NET 7.0" name="GENERATOR ">
<meta content="Visual Basic 7.0" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
<LINK href="Styles.cs s" type="text/css" rel="stylesheet ">
<BODY onresize="retur n Height();"
onload="setTime out('SessionTim eout()',1080000 ); return Height();"
class="backgrou nd">
<!--<p class="sectionH eader">Bank Reconciliation</p>-->
<form id="frmBankReco nDep" method="post" runat="server">
<TABLE id="Table1" cellSpacing="0" cellPadding="0" width="100%" border="0">
<TD class="Report_H eaderColor" style="FONT-WEIGHT: bold; FONT-SIZE:
<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"
<asp:button id="btnNext" runat="server" text="Next >"
DESIGNTIMEDRAGD ROP="65"></asp:button></TD>
<table cellSpacing="1" cellPadding="3" style="FONT-SIZE: 11pt; WIDTH:
<TD class="Report_H eaderColor" align="middle">
<asp:Button id="btnCleared " runat="server" Text="Total Cleared
Deposits" Width="141px"></asp:Button></TD>
<td class="Report_H eaderColor" style="WIDTH: 175px">
<asp:Label id="lblAmount" runat="server"
<td rowSpan="2" class="Report_H eaderColor" style="FONT-SIZE: 11pt">
Please check-off the deposits that have cleared the bank, as listed on
bank statement.</td>
<asp:repeater id="rptDeposits " runat="server">
<HeaderTemplate >
<div id="divTransHea der" style="VISIBILI TY: hidden">
<table id="tblTransHea der" border="0" cellspacing="0"
class="HeaderTa ble">
<colgroup class="ShadeCol HeaderDark">
<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="*">
<tr class="TableHea ders">
<td id="tblTransHea der1_0">
<asp:label text="R/C" id="lblReconcil ed"
Runat="server"> </asp:label></td>
<td id="tblTransHea der1_1">
<asp:LinkButt on id="lnkSortDate " CausesValidatio n="false"
OnCommand="Sort Data" CommandArgument ="transdate" text="Date" Runat="server"
ForeColor="#000 000"></asp:LinkButton> </td>
<td id="tblTransHea der1_2">
<asp:LinkButt on id="lnkSortNumb er" CausesValidatio n="false"
OnCommand="Sort Data" CommandArgument ="depositID" text="Number" Runat="server"
ForeColor="#000 000"></asp:LinkButton> </td>
<td id="tblTransHea der1_3" colspan="2">
<asp:LinkButt on id="lnkSortDesc " CausesValidatio n="false"
OnCommand="Sort Data" CommandArgument ="TransDesc" text="Descripti on"
Runat="server" ForeColor="#000 000"></asp:LinkButton> </td>
<td id="tblTransHea der1_4">
<asp:LinkButt on id="lnkSortPayT ype" CausesValidatio n="false"
OnCommand="Sort Data" CommandArgument ="paymenttyp e" text="Payment Type"
Runat="server" ForeColor="#000 000"></asp:LinkButton> </td>
<td id="tblTransHea der1_5">
<asp:LinkButt on id="lnkSortRece ipt" CausesValidatio n="false"
OnCommand="Sort Data" CommandArgument ="receipt" text="Deposit" Runat="server"
ForeColor="#000 000"></asp:LinkButton> </td>
<td id="tblTransHea der_SCROLL_BAR_ HACK_COLUMN_1"> </td>
<tr class="TableHea ders">
<td id="tblTransHea der2_0" style="BORDER-TOP: white 2px solid">All
<asp:CheckBox ID="chkAll" AutoPostBack=Tr ue
OnCheckedChange d="CheckAll" Runat="server" EnableViewState ="true"/></td>
<td id="tblTransHea der2_1"> </td>
<td id="tblTransHea der2_2"> </td>
<td id="tblTransHea der2_3" style="BORDER-TOP: white 2px solid">
<asp:LinkButt on id="lnkSortCat " CausesValidatio n="false"
OnCommand="Sort Data" CommandArgument ="category" text="Category"
Runat="server" ForeColor="#000 000"></asp:LinkButton> </td>
<td id="tblTransHea der2_4" style="BORDER-TOP: white 2px solid">
<asp:LinkButt on id="lnkSortSubC at" CausesValidatio n="false"
OnCommand="Sort Data" CommandArgument ="subCategor y" text="Sub-Category"
Runat="server" ForeColor="#000 000"></asp:LinkButton> </td>
<td id="tblTransHea der2_5"> </td>
<td id="tblTransHea der2_6"> </td>
<td id="tblTransHea der_SCROLL_BAR_ HACK_COLUMN_2"> </td>
<DIV id="divTransBod y" style="VISIBILI TY: hidden; OVERFLOW: auto;
WIDTH: 100%; HEIGHT: 180px">
<table border="0" cellspacing="0" id="tblTransBod y" width="100%">
<colgroup class="ShadeCol HeaderDark">
<col width="80" id="tblTransBod y1" align="center">
<col width="80" id="tblTransBod y2" align="center">
<col width="100" id="tblTransBod y3" align="center">
<col width="155" id="tblTransBod y4" align="center">
<col width="145" id="tblTransBod y5" align="center">
<col width="100" id="tblTransBod y6" align="center">
<col width="200" id="tblTransBod y7" align="center">
<ItemTemplate >
<tr class="Shade_Tr ans_light">
<asp:CheckBox ID="chkReconcil ed" Checked
=<%#Container.D ataItem("Reconc iled")%> Runat="server" />
<asp:Label ID="lblDepositI d" Runat=server Visible=false
text=<%#Contain er.DataItem("De positID")%>/></td>
<asp:Label ID="lblType" Runat=server Visible=false
text=<%#Contain er.DataItem("Ty pe")%>/></td>
<td><%# Format(Containe r.DataItem("Tra nsDate"), "MM/dd/yyyy") %></td>
<td><%# Container.DataI tem("Number")%> </td>
<td colspan="2">
<asp:Label ID="lblTransDes c" text=<%#
Container.DataI tem("TransDesc" )%> Runat=server visible=true>
<asp:Label ID=lblPayType text=<%# Container.DataI tem("PaymentTyp e")%>
Runat=server visible=true>
<asp:Label ID=lblReceipt text=<%# Container.DataI tem("Receipt") %>
<tr class="Shade_Tr ans_dark">
<td colspan="3">
<asp:Label ID="lblAdjustTr ans" text=<%#
Container.DataI tem("AdjustTran saction")%> runat=server>
<asp:Label ID="lblBatchID " Runat=server Visible=false
text=<%#Contain er.DataItem("pa yroll_ind")%>/>
<asp:Label ID="lblCategory " text=<%# Container.DataI tem("Category") %>
Runat=server visible=true>
<asp:Label ID=lblSubCatego ry text=<%#
Container.DataI tem("SubCategor y")%> Runat=server visible=true>
<td colspan="2">
<asp:LinkButt on ForeColor ="#3333ff" CausesValidatio n=false
ID="lnkAdjust" CommandArgument =<%# Container.DataI tem("DepositID" )%>
OnCommand="lnkA djust_Click" Runat="server">
<SeparatorTempl ate>
<td colspan="10" height="2" bgcolor="black" style="BORDER-RIGHT: white
1px solid; BORDER-LEFT: white 1px solid;"></td>
</SeparatorTempla te>
<FooterTemplate >
</table> </div>
<asp:button id="BtnRefresh " CausesValidatio n="false" Runat="server"
Text="refresh"> </asp:button>
<input type="hidden" id="hdnlnkAdjus t" runat="server"
NAME="hdnlnkAdj ust"> <input type="hidden" id="hdnCancel" runat="server"
NAME="hdnCancel ">
<asp:DataGrid id="DataGrid1" runat="server"> </asp:DataGrid>
<script language="javas cript" src="AlignGridH eaders.js"></script>
<script language="javas cript">
Resizecolumns(t blTransHeader, tblTransBody, divTransBody, 7);
divTransHeader. style.visibilit y = "visible";
divTransBody.st yle.visibility = "visible";

<script language="javas cript">
//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.st yle.height = 402;
else if ((screen.width= =800) && (screen.height= =600))
return divTransBody.st yle.height = 192;}

// 03/06/2006-Added the SessionTimeout( ) function to warn a user of a
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.");

Jun 6 '06 #1
0 2815

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

Similar topics

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
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 me to access it. The funny thing is that it compiles fine, and the checkboxes are there, I just can't write to them! Is there a way around this problem? My HTML is as follows:
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 until it comes time to implement paging. Without paging I can iterate through the repeater when I click 'Select All' and set the checked property to true for all items in the repeater. However when I implement paging, I have to rebind the repeater...
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 help) in a click event of the button that is pushed to enter data. Each time the button is clicked it sends the ID entered by the user to query the database and return information. The renamed controls then include the ID in the name of the...
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
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 repeater and handle each product whose checkbox is checked. The repeater looks (greatly chopped down) like this... <asp:Repeater ID="rptProducts" RunAt="Server">
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 work. This is the code that I used to go thru the repeater control to find my checkboxes. foreach(RepeaterItem r in MyRepeater.Items)
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 and subcategory check boxes and click on submit button , I have to retrieve the corresponding categoryid and subcategory id, so that I can store it to a table. I am getting the categoryid but I am failing to get subcategoryid(actually I don't know...
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 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...
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.