473,769 Members | 6,499 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

best "<tr>" container?

52 New Member
Hi guys,

I'm making an expandable table which currently layers of <table>s are used to contain the table rows in order to show/hide them.

This works, but having to format columns of the child table to be like its parent table can be quite annoying. Before I use tables to do this I use <tbody> to store the <tr>s. Doing so made the format looked perfect unfortunately it could only be used for at most two layers, since having a <tbody> inside another one is illegal.

So my question is; is there another "container" that I can use to show/hide groups of rows, but without having to re-format the rows? Preferably be done on client-side.

Thanks :)



ps. <div> cannot be used to hold table rows, while I think asp:Panel and asp:PlaceHolder might do the trick, I couldn't get them to hide the rows for some reason..
Jan 19 '09 #1
11 2258
Curtis Rutland
3,256 Recognized Expert Specialist
An <asp:Panel> is rendered as a <div> clientside IIRC, so if divs don't work, that won't work.
Jan 19 '09 #2
Plater
7,872 Recognized Expert Expert
Couldn't you just change the CSS class of the rows you want to show/hide?
Jan 19 '09 #3
Frinavale
9,735 Recognized Expert Moderator Expert
You should be able to accomplish this using CSS.
You need to give each row an ID so that you can access it through JavaScript and change it's style client side.

You need to store the IDs of the rows that you wish to control the styles of.
It would be a good idea to store it in a JavaScript Array (using the ClientScript.Re gisterArrayDecl aration method). Your JavaScript method that changes the style will then loop through this declared array and change the styles of the rows listed there.

Although, I'm not sure if this is necessary because I'm not clear on what you are trying to do....

If you change the style of the parent row so that it no longer shows, then all of the child controls within that row will also no longer show....
Jan 19 '09 #4
200dogz
52 New Member
@Plater
Yes I'm using CSS to hide/show. It's just that I feel it might be "nicer" to group the rows into a container, so that instead of having to show/hide all the rows it can be done in one statement :).

If I don't put them into group, it will run into some problems:

Say if I have three layers of rows, if I expand a child row, then its grandchild rows, then collapse the child row. The next time I expand the child row, the grandchild will not be collapsed again...

yea I sucked at explaining stuffs :(
Jan 20 '09 #5
Plater
7,872 Recognized Expert Expert
That situation you were worried about, is generally how most things work?
Jan 20 '09 #6
200dogz
52 New Member
@Plater
Don't think so; at least it's like that for windows explorer, but yea I will definitely give what you guys suggest a try if time allows. Thanks :)
Jan 20 '09 #7
Plater
7,872 Recognized Expert Expert
That is how my explorer works. And how my SQL Server manager works.

If you would prefer that all "grandchild ren" be collapsed when you collapse a child, you could consider having javascript iterate through looking for things to collapse?
Jan 20 '09 #8
200dogz
52 New Member
@Plater
No, what I mean is when you expand the child:

- child
+ gchild

then the grand child:

- child
- gchild
<tr>..
<tr>...

Now collapse the child, and then expand it again, gchild will not be "expanded", because all the rows under child were hidden when we collapsed it. This won't happen if the rows are placed inside containers.

This thing really doesn't bother me; I could go with either way. I was just wondering if there's certain container that can hold rows, while not losing the format of the parent.
Jan 20 '09 #9
200dogz
52 New Member
@200dogz
[FONT=Times New Roman]Container:[/FONT]
[FONT=Times New Roman]Pros:[/FONT]
[FONT=Times New Roman]Cons:[/FONT]
[FONT=Times New Roman]No container[/FONT]
[FONT=Wingdings]l [/FONT][FONT=Times New Roman]No need to reformat the rows.[/FONT]
[FONT=Wingdings]l [/FONT][FONT=Times New Roman]Doesn’t “remember” what children have been expanded when the parent is collapsed.[/FONT]
[FONT=Wingdings]l [/FONT][FONT=Times New Roman]Need to execute one JS statement for each row to be collapsed.[/FONT]
[FONT=Times New Roman]<tbody>[/FONT]
[FONT=Wingdings]l [/FONT][FONT=Times New Roman]Excellent format[/FONT]
[FONT=Wingdings]l [/FONT][FONT=Times New Roman]Limited to maximum two layers.[/FONT]
[FONT=Times New Roman]<table>[/FONT]
[FONT=Wingdings]l [/FONT][FONT=Times New Roman]Structure works.[/FONT]
[FONT=Wingdings]l [/FONT][FONT=Times New Roman]Bad format, table cells size change because of border (even if cellspacing and border width are set to 0)[/FONT]


Like I mentioned, I'm bad at explaining things :(.

Cheers
Jan 20 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

4
10742
by: John MacIntyre | last post by:
Hi, Using the script below, when you click on the radio button beside click here .... the first row shrinks. Has anybody else ever experienced this? Does anybody know of a logical explaination for this? A co-worker told me it is not valid HTML. He may be right, but we both agree; it's odd that IE would handle it when the form is loaded, but not
19
17565
by: CMAR | last post by:
I have the following markup. The problem is that the browser, e.g., IE6, inserts several lines of blank space between the <div> and the following table. Is there a way to minimize that vertical spacing? Thanks, CMA <div class="vlgray">Condition</div> <table cellpadding="0" cellspacing="0">
44
919
by: Jim M | last post by:
I have had great success with using <iframe> with overflow-y set to auto. I can get a similar look with the <iframe> tag. BUT... In all cases I need to have fixed heights. Is there a way to put either tag inside an HTML <TD> and have the same kind of scrolling effect. This would allow me to fill the screen and have the size of the scrolling box change on resize. Thanks in advance.
2
5780
by: bissatch | last post by:
Hi, I am trying to use JavaScript to write a table column on a web page. The code is as follows: <html> <head> <script> function displaycount() {
3
4563
by: Carpe Diem | last post by:
Hello I have an aspx page that loses Session("user") value after a few minutes even after I set <sessionState mode="InProc" cookieless="false" timeout="300"> in web.config and wrote function Session_Start() { Session.Timeout = 3000; } in global.asax
1
5950
by: melda | last post by:
I am a real beginnner in ASP. Due to increasing demands on dynamic website, I've been working on ASP website now. I use a ready to use CMS program and right now I've been trying to combine a calendar module into my CMS. The calendar works fine except that if I click on the date or the month earlier or later, the page always goes back to the first page which is first opened. You can take a look at this address:...
1
2244
by: yawnmoth | last post by:
I'm trying to mess around with PHP5's DOM functions and have run into something that confuses me: <?php $dom = new DOMDocument(); $dom->loadHTML('<html></html>'); echo $dom->childNodes->length; ?>
3
4541
by: laredotornado | last post by:
Hi, Below I have an unordered list that is displayed on the same horizontal plane (thanks for the help yesterday). What I am wondering now is I would like the contents of the DIV with class "tabs- container" to be always displayed on the next line. Right now, it is being displayed on the same line as the unordered list. I could apply a <BRtag, I suppose, but I was hoping there is a more elegant, CSS way to move the content to the...
36
5108
by: Roedy Green | last post by:
The only browser I have encountered that supports <colgroup><col class="behold"></colgroup> to apply a CSS style to a whole column, is Microsoft Internet Explorer. I have been told it SHOULD NOT do so, since this is not part of the specification. How then to you apply styles to entire columns? Surely you don't have to write <td class="behold"on every row item.
0
9423
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
10211
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9993
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
8870
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
6672
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
5298
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...
1
3958
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
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.