最好的"< tr>"容器? [英] best "<tr>" container?

查看:58
本文介绍了最好的"< tr>"容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在制作一个可扩展的表格,目前< table> 的图层用于包含表格行为了显示/隐藏它们。


这样可行,但是必须将子表的列格式设置为与其父表相似可能会非常烦人。在我使用表格之前,我使用< tbody> 来存储< tr> s。这样做使得格式看起来很完美,不幸的是它最多只能用于两层,因为有一个< tbody>在另一个内部是非法的。


所以我的问题是;还有另一个容器我可以用来显示/隐藏行组,但不必重新格式化行?最好在客户端完成。


谢谢:)



ps。 < DIV>不能用来保存表行,而我认为asp:Panel和asp:PlaceHolder可能会做的伎俩,我不能让它们出于某种原因隐藏行..

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..

推荐答案

< asp:Panel>呈现为< div>客户端IIRC,所以如果div不工作,那就不行了。
An <asp:Panel> is rendered as a <div> clientside IIRC, so if divs don''t work, that won''t work.


你难道不能只改变想要显示/隐藏的行的CSS类吗?
Couldn''t you just change the CSS class of the rows you want to show/hide?


您应该能够使用CSS完成此任务。

您需要为每一行提供一个ID,以便您可以通过JavaScript访问它并更改它''样式客户端。


您需要存储您希望控制样式的行的ID。

这是一个好主意将其存储在JavaScript数组中(使用ClientScript.RegisterArrayDeclaration方法)。你改变样式的JavaScript方法将循环遍历这个声明的数组并改变那里列出的行的样式。


虽然,我不确定这是否有必要因为我我不清楚你要做什么....


如果更改父行的样式以使其不再显示,则所有子控件在该行内也将不再显示....
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.RegisterArrayDeclaration 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....


这篇关于最好的&quot;&lt; tr&gt;&quot;容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆