473,396 Members | 2,059 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,396 software developers and data experts.

Nested repeater controls show/hide?

Hi All,

Posted after extensive searching!

I have a nested repeater control as follows: (Simplified ;-))

<table>
<asp:repeater id=parent onItemDataBound=createChild>
<tr><td>Level 1</td></tr>
<asp:repeater id=child>
<tr id=childrow><td>Level 2</td></tr>
</asp:repeater>
</asp:repeater>
</table>

They are both created from a SQL query. I would simply like to not
display the child if the parent meets a condition. I would therefore
like to add a style="display: none;" attribute to the row 'childrow'.

How can I access the child of the parent in the onItemDataBound event,
which is when it gets created? I can access anything outside the child
repeater but not inside it.

(As a side issues all ID's are dynamically created at databind time
for use with Javascript etc.)

Help would be much appreciated!

Thanks
John Sourcrer
Nov 19 '05 #1
3 4399
You say you can't access anthing inside the child repeater, but can you
access the child repeater itself ala e.Item.FindControl("child") if so,
why not just set it's visiblility to false, not bind it and voila?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"sorCrer" <ju**@spirit.co.za> wrote in message
news:dc*************************@posting.google.co m...
Hi All,

Posted after extensive searching!

I have a nested repeater control as follows: (Simplified ;-))

<table>
<asp:repeater id=parent onItemDataBound=createChild>
<tr><td>Level 1</td></tr>
<asp:repeater id=child>
<tr id=childrow><td>Level 2</td></tr>
</asp:repeater>
</asp:repeater>
</table>

They are both created from a SQL query. I would simply like to not
display the child if the parent meets a condition. I would therefore
like to add a style="display: none;" attribute to the row 'childrow'.

How can I access the child of the parent in the onItemDataBound event,
which is when it gets created? I can access anything outside the child
repeater but not inside it.

(As a side issues all ID's are dynamically created at databind time
for use with Javascript etc.)

Help would be much appreciated!

Thanks
John Sourcrer

Nov 19 '05 #2
Hi Karl,

Thanks for your post but this I can do! What I am trying to do is bind
the data, then add a style attribute that sets its display property to
false. I need to do this because I want to dynamically display the
children when a user clicks on a +/- icon. Like any standard tree type
menu.

Any ideas?

Interesting articles on your site BTW.

Regards
John

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:<ed**************@TK2MSFTNGP09.phx.gbl>...
You say you can't access anthing inside the child repeater, but can you
access the child repeater itself ala e.Item.FindControl("child") if so,
why not just set it's visiblility to false, not bind it and voila?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"sorCrer" <ju**@spirit.co.za> wrote in message
news:dc*************************@posting.google.co m...
Hi All,

Posted after extensive searching!

I have a nested repeater control as follows: (Simplified ;-))

<table>
<asp:repeater id=parent onItemDataBound=createChild>
<tr><td>Level 1</td></tr>
<asp:repeater id=child>
<tr id=childrow><td>Level 2</td></tr>
</asp:repeater>
</asp:repeater>
</table>

They are both created from a SQL query. I would simply like to not
display the child if the parent meets a condition. I would therefore
like to add a style="display: none;" attribute to the row 'childrow'.

How can I access the child of the parent in the onItemDataBound event,
which is when it gets created? I can access anything outside the child
repeater but not inside it.

(As a side issues all ID's are dynamically created at databind time
for use with Javascript etc.)

Help would be much appreciated!

Thanks
John Sourcrer

Nov 19 '05 #3
John:
You could simply use
http://www.denisbauer.com/ASPNETCont...ierarGrid.aspx

You'll likely have some difficulty doing this with a repeater, namely
because I assume you have something like:

<HeaderTemplate>
<table border="0" ...>
</headertemplate>
<itemTempalte>...</ItemTEmplate>
<footerTempalte</table></footerTemplate>

and you need to programatically set the visibility style of the <Table>
which you won't be able to find using FindControl since it isn't a server
control...you can't simply add a runat=server (I think) because it doesn't
think it has a closing </table> tag.

What you could do is place the table control outside the child repeater:
<ItemTemplate>
<td><%# DataBinder.Eval(Container.DataItem ,"Name")%>
<table id="x" runat="server">
<asp:Repeater ID="inner" DataSource='...' Runat="server">
<ItemTemplate>
<tr><td><%# DataBinder.Eval(Container.DataItem,
"Amount")%></td></td>
</ItemTemplate>
</asp:Repeater>
</table>>
</td>
</ItemTemplate>

which you could then access it from the outer repeater...or simply use:

<table style='visibility:<%# GetVisibility(Container.DataItem) %>'> or
something...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/index.aspx - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"sorCrer" <ju**@spirit.co.za> wrote in message
news:dc**************************@posting.google.c om...
Hi Karl,

Thanks for your post but this I can do! What I am trying to do is bind
the data, then add a style attribute that sets its display property to
false. I need to do this because I want to dynamically display the
children when a user clicks on a +/- icon. Like any standard tree type
menu.

Any ideas?

Interesting articles on your site BTW.

Regards
John

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>

wrote in message news:<ed**************@TK2MSFTNGP09.phx.gbl>...
You say you can't access anthing inside the child repeater, but can you
access the child repeater itself ala e.Item.FindControl("child") if so, why not just set it's visiblility to false, not bind it and voila?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"sorCrer" <ju**@spirit.co.za> wrote in message
news:dc*************************@posting.google.co m...
Hi All,

Posted after extensive searching!

I have a nested repeater control as follows: (Simplified ;-))

<table>
<asp:repeater id=parent onItemDataBound=createChild>
<tr><td>Level 1</td></tr>
<asp:repeater id=child>
<tr id=childrow><td>Level 2</td></tr>
</asp:repeater>
</asp:repeater>
</table>

They are both created from a SQL query. I would simply like to not
display the child if the parent meets a condition. I would therefore
like to add a style="display: none;" attribute to the row 'childrow'.

How can I access the child of the parent in the onItemDataBound event,
which is when it gets created? I can access anything outside the child
repeater but not inside it.

(As a side issues all ID's are dynamically created at databind time
for use with Javascript etc.)

Help would be much appreciated!

Thanks
John Sourcrer

Nov 19 '05 #4

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

Similar topics

0
by: mark | last post by:
My problem is I need to have a "nested" repeater. I have an array which I load into a hashtable - that part works great. I can setup the second repeater to work just fine, as long as it's not...
12
by: Jerad Rose | last post by:
I searched for a while trying to find the answer to this, but to no avail. I am trying to find the best way (or any way) to dynamically show and hide groups of TR's. For example, I have a...
0
by: Ed Allan | last post by:
I have extended the example at http://support.microsoft.com/default.aspx?scid=kb;EN- US;306154 to build a webform page with 3 layers of nested Repeaters on (ie. parent, child and grandchild). I...
0
by: Ed Allan | last post by:
http://ejaconsulting.com/nestedrepeater/NestedRepeater.txt >-----Original Message----- >Doh! The HTML has all been rendered . . . > >Right click on this link and select 'Save target as ..' >to...
0
by: Maziar Aflatoun | last post by:
Hi, I found an example on Microsoft on having nest repeater controls. So I created a 3 tables -> Categories, Users and UserInfo. I like to display all the Categories and under it display all...
2
by: Matt Jensen | last post by:
Howdy I have 2 repeaters on a C# page, 1 nested under the other. In some cases, the nested repeaters <ItemTemplate> does not contain rows - how does one display a text message in place of the...
1
by: Charlie | last post by:
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. ...
2
by: mark | last post by:
(not sure if this is the correct group) My problem is I need to have a "nested" repeater. I have an array which I load into a hashtable - that part works great. I can setup the second repeater...
0
by: bdtmike | last post by:
I'm trying to set up a nested repeater to display master/child data. To do this I'm using 2 repeater controls and I'm using 2 SQLDataSource controls. I'm clear on embeding one repeater inside the...
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: 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?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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,...

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.