473,618 Members | 3,044 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing child controls of a nested repeater control

Hi:

I'm laying out a hieraracical report by nesting repeater controls. I'm
using panels to expand/collapse detail sections. To access a panel in a
nested repeater, I use the following code. The problem is I can get a
reference to a nested repeater, but can not use that reference to access the
panel within.

protected void rptrOrders_Item Command(object source,
System.Web.UI.W ebControls.Repe aterCommandEven tArgs e) {

Repeater rpt = (Repeater) e.Item.FindCont rol("rptrItems" );

Panel pnl = (Panel) rpt.FindControl ("panelItems "); // Problem here,
returns null

if (pnl.Visible == false) {

pnl.Visible = true;

}
else {

pnl.Visible = false;

}
}
Nov 19 '05 #1
1 3905
The panel named "panelItems " would be within one of the items of the child
repeater. Try something like this:

foreach (RepeaterItem rpi in rpt.Items)
{
Panel pnl = (Panel) rpi.FindControl ("panelItems ");
if ( pnl!= null) pnl.Visible =!pnl.Visible ;
}
--
HTH,
Phillip Williams
http://www.societopia.net/Samples
http://www.webswapp.com
"Charlie@CB FC" wrote:
Hi:

I'm laying out a hieraracical report by nesting repeater controls. I'm
using panels to expand/collapse detail sections. To access a panel in a
nested repeater, I use the following code. The problem is I can get a
reference to a nested repeater, but can not use that reference to access the
panel within.

protected void rptrOrders_Item Command(object source,
System.Web.UI.W ebControls.Repe aterCommandEven tArgs e) {

Repeater rpt = (Repeater) e.Item.FindCont rol("rptrItems" );

Panel pnl = (Panel) rpt.FindControl ("panelItems "); // Problem here,
returns null

if (pnl.Visible == false) {

pnl.Visible = true;

}
else {

pnl.Visible = false;

}
}

Nov 19 '05 #2

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

Similar topics

3
14714
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
4
2049
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...
1
2002
by: Neil | last post by:
Hi, I have a repeater object which is bound to a dataset, the repeater has one item template which contains dropdowns, checklist, text boxes etc. After the repeater has rendered the user can change the values in the child controls and add new rows to the repeater. The user then clicks save changes and I need to update the database with the changes. I was thinking of looping through the datatables row collection and checking the...
1
1298
by: humbleFunGuy | last post by:
What does nested controls mean in .Net? Any help is appreciated. Thanks, fanzi
3
19335
by: Martin | last post by:
Hi, I have a very frustrating problem that I have researched for countless hours to no avail. There are many posts asking very similar things, however none usefull in my situation. I am using VS 2005 (ASP 2.0) and VB .NET. I have a page with a datalist, a gridview and then other data controls, nested in that order. This all works great, and produces a nice looking page, but I cannot for the life of me figure out how to reference
1
2091
by: Dave | last post by:
I have the following ASP.NET 2.0 code (simplified here for ease): <asp:Repeater id="SearchResultsRepeater" runat="server"> <ItemTemplate> <uc:SearchResult ID="SearchResult" ResultObject="<%#Container.DataItem%>" runat="server"> <ButtonsTemplate> <uc:ViewButton ID="ViewButton" ListingReference='<%#Eval("ListingReference")%>' runat="server" /> </ButtonsTemplate>
2
2641
by: AC [MVP MOSS] | last post by:
I have a repeater with a header, footer, and item template. The item template is the only one with server controls (hyperlinks, labels, and a nested repeater). Within the top repeater, I'm handling the ItemDataBound method in the code behind. In this handler, I need to get access to the controls within the ItemTemplate.... however I've only found one way to do this (and i"m not sure why it works). Once I cast the sender (first param...
3
2104
by: s.bussing | last post by:
Hi, I have been reading for hours now, but I'm still not able to solve my problem, though a lot of people are struggling with something similar. On my page I have a nested repeater. In the inner repeater for each item a usercontrol is added which has a textbox and two buttons. No I know that when the page is posted back (in my case by pushing one of the buttons of the control), I have to recreate all the dynamic control. I want to...
5
4102
by: gerry | last post by:
I am trying to create a custom container control that will only ever contain a specific type of control. At design time, when a control of a different type is added to the container I would like to wrap the control in the proper control type - which is also a container. At design time I want to be able to turn this : <my:container> <asp:textbox />
0
8212
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, 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...
0
8153
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,...
0
8595
jinu1996
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...
1
8304
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,...
0
8455
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7126
agi2029
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...
0
5552
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();...
0
4150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2587
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.