Results 1 to 5 of 5

Thread: Hiding table rows

  1. #1

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Hiding table rows

    Hi,

    I have a table (this is a basic example, but my table is slightly more complex):

    Code:
    <table>
      <tr>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <td></td>
        <td></td>
      </tr>
    Inside the table cells I have some .NET controls.

    While the page loads I get some data from the DB and depending on that data I need to hide/show certain table rows.

    What I have done in the past is instead of multiple <td>'s I use 1 and add a panel in there with another table in that and then I hide/show the panel.

    But in this case I need the table rows hidden.

    I can do this by saying:

    Code:
    if(data.Equals("XC"))
    {
       Control1.Visible = false;
       Control2.Visible = false;
       Control3.Visible = true;
    }
    However, I want to avoid this method if possible.

    Any ideas?

    Woof

  2. #2
    Frenzied Member brin351's Avatar
    Join Date
    Mar 2007
    Location
    Land Down Under
    Posts
    1,293

    Re: Hiding table rows

    If this is all server side in the pageLoad event you can runat=server the table and show hide the <tr>, <td> tags, optionally you could set a css style on the tr/td tags where the controls are on the page just not visible.

  3. #3

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Hiding table rows

    yea, that's what i started using...then paused...and decided to ask here 1st
    If I had done it all like that, someone would have only said "Tut ut...you should have done it like this...."



    Woof

  4. #4
    Frenzied Member brin351's Avatar
    Join Date
    Mar 2007
    Location
    Land Down Under
    Posts
    1,293

    Re: Hiding table rows

    I'd like to know the better way too, It's all just show/hide a table row, panel or div depending on the markup you want isn't it.

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Hiding table rows

    This is the correct way. I have spoken.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width