Dynamically Show/Hide Groups of TR's

Discussion in 'ASP .Net' started by Jerad Rose, Jun 24, 2003.

  1. Jerad Rose

    Jerad Rose Guest

    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 section of about 6 table rows that
    all need to be hidden if a certain condition is met. But I don't want to
    hide the whole table. And, I don't want to split up the table because the
    columns need to remain intact.

    I thought about using runat=server on each of the TR's, and just hiding them
    each individually, but that just seems really sloppy, and I thought there
    had to be a better way to do it. I really need some sort of HTML-less
    container that can serve as a wrapper for the TR's without rendering any
    additional HTML.

    An asp:placeHolder would be perfect since it doesn't render any additional
    HTML, but it doesn't allow any other nested server controls at design time
    (which seems silly). And an asp:panel can wrap around any HTML or server
    controls, but it renders HTML (div in IE and table in Netscape -- which
    really hoses the HTML). And a <span runat=server> doesn't like nested TR's.

    I just need some "wrapper" server control that can contain anything (HTML
    and Server controls) without rendering ANY HTML on any browser. Seems like
    this would be widely used (and needed) feature, but I haven't had much luck
    finding such a thing.

    Any suggestions would be appreciated.

    Thanks in advance for your help!
    Jerad
     
    Jerad Rose, Jun 24, 2003
    #1
    1. Advertising

  2. Jerad Rose

    PJ Guest

    I use the PlaceHolder around <tr> elements all the time. This might not
    work if you are using an asp table object, but if you are, don't....it's
    uncessary overhead. Also, maybe it's giving you an error in design view,
    but if it is...don't use design view, use HTML view.

    ~PJ

    "Jerad Rose" <> wrote in message
    news:...
    > 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 section of about 6 table rows that
    > all need to be hidden if a certain condition is met. But I don't want to
    > hide the whole table. And, I don't want to split up the table because the
    > columns need to remain intact.
    >
    > I thought about using runat=server on each of the TR's, and just hiding

    them
    > each individually, but that just seems really sloppy, and I thought there
    > had to be a better way to do it. I really need some sort of HTML-less
    > container that can serve as a wrapper for the TR's without rendering any
    > additional HTML.
    >
    > An asp:placeHolder would be perfect since it doesn't render any additional
    > HTML, but it doesn't allow any other nested server controls at design time
    > (which seems silly). And an asp:panel can wrap around any HTML or server
    > controls, but it renders HTML (div in IE and table in Netscape -- which
    > really hoses the HTML). And a <span runat=server> doesn't like nested

    TR's.
    >
    > I just need some "wrapper" server control that can contain anything (HTML
    > and Server controls) without rendering ANY HTML on any browser. Seems

    like
    > this would be widely used (and needed) feature, but I haven't had much

    luck
    > finding such a thing.
    >
    > Any suggestions would be appreciated.
    >
    > Thanks in advance for your help!
    > Jerad
    >
    >
     
    PJ, Jun 25, 2003
    #2
    1. Advertising

  3. Jerad Rose

    Natty Gur Guest

    Hi,

    Why do you think that make the TR runat=server is sloppy ?
    runat=server is one of the bases of ASP.NET.

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Natty Gur, Jun 25, 2003
    #3
  4. Jerad Rose

    Jerad Rose Guest

    > I use the PlaceHolder around <tr> elements all the time.

    It's not the <tr> elements that the PlaceHolder is having problems with --
    it's the server controls that are within my <tr> elements that the
    PlaceHolder doesn't support. Like I said, I need something that will allow
    both embedded HTML _and_ server controls.

    Thanks for your reply, but it doesn't seem like a PlaceHolder is going to
    work with this situation.

    "PJ" <> wrote in message
    news:uJD%...
    > I use the PlaceHolder around <tr> elements all the time. This might not
    > work if you are using an asp table object, but if you are, don't....it's
    > uncessary overhead. Also, maybe it's giving you an error in design view,
    > but if it is...don't use design view, use HTML view.
    >
    > ~PJ
    >
    > "Jerad Rose" <> wrote in message
    > news:...
    > > 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 section of about 6 table rows

    that
    > > all need to be hidden if a certain condition is met. But I don't want

    to
    > > hide the whole table. And, I don't want to split up the table because

    the
    > > columns need to remain intact.
    > >
    > > I thought about using runat=server on each of the TR's, and just hiding

    > them
    > > each individually, but that just seems really sloppy, and I thought

    there
    > > had to be a better way to do it. I really need some sort of HTML-less
    > > container that can serve as a wrapper for the TR's without rendering any
    > > additional HTML.
    > >
    > > An asp:placeHolder would be perfect since it doesn't render any

    additional
    > > HTML, but it doesn't allow any other nested server controls at design

    time
    > > (which seems silly). And an asp:panel can wrap around any HTML or

    server
    > > controls, but it renders HTML (div in IE and table in Netscape -- which
    > > really hoses the HTML). And a <span runat=server> doesn't like nested

    > TR's.
    > >
    > > I just need some "wrapper" server control that can contain anything

    (HTML
    > > and Server controls) without rendering ANY HTML on any browser. Seems

    > like
    > > this would be widely used (and needed) feature, but I haven't had much

    > luck
    > > finding such a thing.
    > >
    > > Any suggestions would be appreciated.
    > >
    > > Thanks in advance for your help!
    > > Jerad
    > >
    > >

    >
    >
     
    Jerad Rose, Jun 25, 2003
    #4
  5. Jerad Rose

    Jerad Rose Guest

    > Why do you think that make the TR runat=server is sloppy ?

    I don't have a problem with <tr runat=server> at all. In fact, I use that
    quite a bit when I'm just wanting to show/hide a certain row. But I just
    don't like having to show/hide 6 individual rows when it would be much
    cleaner to group them in a container and just show/hide the whole container.

    Thanks for your response nonetheless.

    "Natty Gur" <> wrote in message
    news:...
    > Hi,
    >
    > Why do you think that make the TR runat=server is sloppy ?
    > runat=server is one of the bases of ASP.NET.
    >
    > Natty Gur, CTO
    > Dao2Com Ltd.
    > 28th Baruch Hirsch st. Bnei-Brak
    > Israel , 51114
    >
    > Phone Numbers:
    > Office: +972-(0)3-5786668
    > Fax: +972-(0)3-5703475
    > Mobile: +972-(0)58-888377
    >
    > Know the overall picture
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Jerad Rose, Jun 25, 2003
    #5
  6. Jerad Rose

    Jerad Rose Guest

    Well, the problem is, these TRs are subset of a larger table. So if I split
    these TRs into their own table, I'll lose column formatting.

    Thanks for the suggestion anyway.

    "Natty Gur" <> wrote in message
    news:%...
    > Just a suggestion,
    >
    >
    > If you can group those TDs maybe you can use template column that will
    > hold another grid. This way you can hide the entire inner grid.
    >
    > Natty Gur, CTO
    > Dao2Com Ltd.
    > 28th Baruch Hirsch st. Bnei-Brak
    > Israel , 51114
    >
    > Phone Numbers:
    > Office: +972-(0)3-5786668
    > Fax: +972-(0)3-5703475
    > Mobile: +972-(0)58-888377
    >
    > Know the overall picture
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Jerad Rose, Jun 25, 2003
    #6
  7. Jerad Rose

    Natty Gur Guest

    I meant something like heiarchal grid (but without the +). so the
    columns formatting is the same.

    Hope i was clear

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Natty Gur, Jun 25, 2003
    #7
  8. Jerad Rose

    Jerad Rose Guest

    Hmm... not sure if I'm understanding you, but if so, it actually sounds like
    this may be more trouble (and less elegant) than just hiding the TRs
    individually -- which was Plan B.

    I'm surprised that .NET doesn't have some generic container control than can
    just wrap around a section of HTML/server controls for easy dynamic
    hiding/showing. This is really all I'm looking for.

    "Natty Gur" <> wrote in message
    news:...
    > I meant something like heiarchal grid (but without the +). so the
    > columns formatting is the same.
    >
    > Hope i was clear
    >
    > Natty Gur, CTO
    > Dao2Com Ltd.
    > 28th Baruch Hirsch st. Bnei-Brak
    > Israel , 51114
    >
    > Phone Numbers:
    > Office: +972-(0)3-5786668
    > Fax: +972-(0)3-5703475
    > Mobile: +972-(0)58-888377
    >
    > Know the overall picture
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Jerad Rose, Jun 25, 2003
    #8
  9. Jerad Rose

    Natty Gur Guest

    1) Yes plan B is better.

    2) .Net got such controls but you cant use them inside complex HTML tags
    (TABLE).

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Natty Gur, Jun 25, 2003
    #9
  10. Jerad Rose

    PJ Guest

    I don't know what you mean...a PlaceHolder can have any type of control
    inside of it. Here is a code snippet where I use a place holder and it
    works perfectly...in fact....i have place holders embedded inside of
    placeholders. I have a repeater and my custom controls in a placeholder. I
    have placeholders inside the repeater which is inside another placeholder,
    etc, etc. This page builds a grid view of images in 3 columns where the
    bottom row may have 1 to 3 cells, so on the OnItemDataBound of the repeater
    I Mod the itemindex to decide whether or not I start or end <tr> tags....

    ~PJ

    <b2b:browsetree id="bt" runat="server" cssclass="browsetree" />
    <div class="browse">
    <br /><br />
    <asp:placeholder id="main" runat="server">
    <asp:label id="mainText" runat="server"></asp:label>
    </asp:placeholder>

    <asp:placeholder id="grid" runat="server" visible="false">
    <asp:dropdownlist id="ddlFolder" runat="server" autopostback="True"
    width="177px" style="margin-bottom:10px;margin-left:0px"></asp:dropdownlist>
    <pwc:pager id="pagerTop" runat="server"
    style="height:20px;width:360px;text-align:right"/>
    <table width="540px" cellpadding="2" cellspacing="0" border="0"
    style="border:1px solid #3366ff">
    <asp:repeater id="rptMain" runat="server">
    <itemtemplate>
    <asp:placeholder id="rowBegin" runat="server"><tr style="height:180px"
    valign="middle"></asp:placeholder>
    <td width="33%" align="center">
    <asp:imagebutton id="btnImgSlide" runat="server"></asp:imagebutton>
    <span id="spanSlide" runat="server"
    style="background-image:url(/b2b/images/layout/slide.gif);height:128px;width
    :128px;padding-top:55px">
    <asp:linkbutton id="btnLinkSlide" runat="server"
    forecolor="black"></asp:linkbutton></span></td>
    <asp:placeholder id="rowEnd" runat="server"></tr></asp:placeholder>
    </itemtemplate>
    </asp:repeater>
    <asp:placeholder id="fillOneCell"
    runat="server"><td>&nbsp;</td></asp:placeholder><asp:placeholder
    id="fillTwoCell" runat="server"><td>&nbsp;</td></asp:placeholder>
    </table>

    </asp:placeholder>
    </div>




    "Jerad Rose" <> wrote in message
    news:%...
    > > I use the PlaceHolder around <tr> elements all the time.

    >
    > It's not the <tr> elements that the PlaceHolder is having problems with --
    > it's the server controls that are within my <tr> elements that the
    > PlaceHolder doesn't support. Like I said, I need something that will

    allow
    > both embedded HTML _and_ server controls.
    >
    > Thanks for your reply, but it doesn't seem like a PlaceHolder is going to
    > work with this situation.
    >
    > "PJ" <> wrote in message
    > news:uJD%...
    > > I use the PlaceHolder around <tr> elements all the time. This might not
    > > work if you are using an asp table object, but if you are, don't....it's
    > > uncessary overhead. Also, maybe it's giving you an error in design

    view,
    > > but if it is...don't use design view, use HTML view.
    > >
    > > ~PJ
    > >
    > > "Jerad Rose" <> wrote in message
    > > news:...
    > > > 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 section of about 6 table rows

    > that
    > > > all need to be hidden if a certain condition is met. But I don't want

    > to
    > > > hide the whole table. And, I don't want to split up the table because

    > the
    > > > columns need to remain intact.
    > > >
    > > > I thought about using runat=server on each of the TR's, and just

    hiding
    > > them
    > > > each individually, but that just seems really sloppy, and I thought

    > there
    > > > had to be a better way to do it. I really need some sort of HTML-less
    > > > container that can serve as a wrapper for the TR's without rendering

    any
    > > > additional HTML.
    > > >
    > > > An asp:placeHolder would be perfect since it doesn't render any

    > additional
    > > > HTML, but it doesn't allow any other nested server controls at design

    > time
    > > > (which seems silly). And an asp:panel can wrap around any HTML or

    > server
    > > > controls, but it renders HTML (div in IE and table in Netscape --

    which
    > > > really hoses the HTML). And a <span runat=server> doesn't like nested

    > > TR's.
    > > >
    > > > I just need some "wrapper" server control that can contain anything

    > (HTML
    > > > and Server controls) without rendering ANY HTML on any browser. Seems

    > > like
    > > > this would be widely used (and needed) feature, but I haven't had much

    > > luck
    > > > finding such a thing.
    > > >
    > > > Any suggestions would be appreciated.
    > > >
    > > > Thanks in advance for your help!
    > > > Jerad
    > > >
    > > >

    > >
    > >

    >
    >
     
    PJ, Jun 26, 2003
    #10
  11. Jerad Rose

    JFChenier Guest

    To hide/show multiple rows, try this::

    <table>
    <tr><td><a onclck="showHide()">show/hide block1</a></td></tr>
    <tbody id="id1">
    <tr><td>blabla1</td></tr>
    <tr><td>blabla2</td></tr>
    </tbody>
    <tbody id="id2">
    <tr><td>blabla3</td></tr>
    <tr><td>blabla4</td></tr>
    </tbody>
    </table>

    <script language="javascript">
    function showHide() {
    if(document.getElementById('id1').style.display=="none") {
    document.getElementById('id1').style.display="";
    } else {
    document.getElementById('id1').style.display="none";
    }
    }
    </script>


    Simply add arguments to the function to make it show/hide the specifi
    row group that you prefer.
    This example will only show/hide the first group.


    (first post ever :), hope it helps

    --
    JFChenie
    -----------------------------------------------------------------------
    JFChenier's Profile: http://www.highdots.com/forums/member.php?userid=27
    View this thread: http://www.highdots.com/forums/showthread.php?t=62760
     
    JFChenier, Jun 16, 2005
    #11
  12. Jerad Rose

    Guest Guest

    <table>
    <theader>
    <tr>
    <td>there can be only one theader</td>
    </tr>
    </theader>
    <tbody runat="server">
    <tr>
    <td>You can have as many tbody elements in a form as needed.</td>
    </tr>
    </tbody>
    <tfooter>
    <tr>
    <td>Can only be one tfooter.</td>
    </tr>
    </tfooter>
    </table>

    This was only a thought, please let me know how this works out for you.

    Art Clark, MCSD, MCDBA
    "Natty Gur" <> wrote in message
    news:...
    > 1) Yes plan B is better.
    >
    > 2) .Net got such controls but you cant use them inside complex HTML tags
    > (TABLE).
    >
    > Natty Gur, CTO
    > Dao2Com Ltd.
    > 28th Baruch Hirsch st. Bnei-Brak
    > Israel , 51114
    >
    > Phone Numbers:
    > Office: +972-(0)3-5786668
    > Fax: +972-(0)3-5703475
    > Mobile: +972-(0)58-888377
    >
    > Know the overall picture
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Guest, Jul 10, 2005
    #12
  13. Jerad Rose

    intrader Guest

    On Sun, 10 Jul 2005 02:27:32 -0400, user wrote:

    > <table>
    > <theader>
    > <tr>
    > <td>there can be only one theader</td>
    > </tr>
    > </theader>
    > <tbody runat="server">
    > <tr>
    > <td>You can have as many tbody elements in a form as needed.</td>
    > </tr>
    > </tbody>
    > <tfooter>
    > <tr>
    > <td>Can only be one tfooter.</td>
    > </tr>
    > </tfooter>
    > </table>
    >
    > This was only a thought, please let me know how this works out for you.
    >
    > Art Clark, MCSD, MCDBA
    > "Natty Gur" <> wrote in message
    > news:...
    >> 1) Yes plan B is better.
    >>
    >> 2) .Net got such controls but you cant use them inside complex HTML tags
    >> (TABLE).
    >>
    >> Natty Gur, CTO
    >> Dao2Com Ltd.
    >> 28th Baruch Hirsch st. Bnei-Brak
    >> Israel , 51114
    >>
    >> Phone Numbers:
    >> Office: +972-(0)3-5786668
    >> Fax: +972-(0)3-5703475
    >> Mobile: +972-(0)58-888377
    >>
    >> Know the overall picture
    >>
    >>
    >> *** Sent via Developersdex http://www.developersdex.com ***
    >> Don't just participate in USENET...get rewarded for it!

    YOu can ignore the warning errror message when you use tbody inside a
    repeater for example.
     
    intrader, Jul 10, 2005
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nathan Sokalski
    Replies:
    2
    Views:
    1,017
    Nathan Sokalski
    Oct 13, 2006
  2. gnewsgroup

    Dynamically show/hide gridview footer?

    gnewsgroup, Oct 23, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    4,944
    gnewsgroup
    Oct 23, 2007
  3. dynamically hide/show delete

    , Jun 1, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    119
  4. Nathan Sokalski

    Design View when using an ASP:Panel to show/hide groups of <tr>'s

    Nathan Sokalski, Oct 12, 2006, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    202
    Nathan Sokalski
    Oct 13, 2006
  5. ll
    Replies:
    2
    Views:
    653
    Thomas 'PointedEars' Lahn
    May 1, 2008
Loading...

Share This Page