hiding table rows by id?

Discussion in 'ASP .Net' started by MattB, Mar 9, 2005.

  1. MattB

    MattB Guest

    I'm trying to have a table that I can selectively hide or show it's rows
    depending on some data in a database.
    I see that I can refer to a row by index and toggle it's visible
    property that way (mytable.rows(0).visible = false), but I may not
    always know the order of rows so I'd love to be able to refer to a row
    by id. It appears that can't be done the way I was trying, but is there
    another alternative or workaround to do what I'd like?

    I want to be able to have a row in an unknown position selectively shown
    or hidden. Any hints or suggestions would be appreciated!

    One thought I'll try now: Can I loop through the rows collection, check
    id's, and then show/hide by current index?

    Thanks!

    Matt
     
    MattB, Mar 9, 2005
    #1
    1. Advertising

  2. Is this server side or client side?

    Assume your rowID is "Row7"

    Client side
    document.all["Row7"].style.display = "none";

    Server side

    myTable.FindControl( "Row7").Visible = false;

    HTH,

    bill

    "MattB" <> wrote in message
    news:...
    > I'm trying to have a table that I can selectively hide or show it's rows
    > depending on some data in a database.
    > I see that I can refer to a row by index and toggle it's visible
    > property that way (mytable.rows(0).visible = false), but I may not
    > always know the order of rows so I'd love to be able to refer to a row
    > by id. It appears that can't be done the way I was trying, but is there
    > another alternative or workaround to do what I'd like?
    >
    > I want to be able to have a row in an unknown position selectively shown
    > or hidden. Any hints or suggestions would be appreciated!
    >
    > One thought I'll try now: Can I loop through the rows collection, check
    > id's, and then show/hide by current index?
    >
    > Thanks!
    >
    > Matt
     
    William F. Robertson, Jr., Mar 9, 2005
    #2
    1. Advertising

  3. MattB

    MattB Guest

    Sorry I forgot to mention it was server side. Your suggestion was very
    helpful. Thanks!

    Matt

    William F. Robertson, Jr. wrote:
    > Is this server side or client side?
    >
    > Assume your rowID is "Row7"
    >
    > Client side
    > document.all["Row7"].style.display = "none";
    >
    > Server side
    >
    > myTable.FindControl( "Row7").Visible = false;
    >
    > HTH,
    >
    > bill
    >
    > "MattB" <> wrote in message
    > news:...
    >
    >>I'm trying to have a table that I can selectively hide or show it's rows
    >>depending on some data in a database.
    >>I see that I can refer to a row by index and toggle it's visible
    >>property that way (mytable.rows(0).visible = false), but I may not
    >>always know the order of rows so I'd love to be able to refer to a row
    >>by id. It appears that can't be done the way I was trying, but is there
    >>another alternative or workaround to do what I'd like?
    >>
    >>I want to be able to have a row in an unknown position selectively shown
    >>or hidden. Any hints or suggestions would be appreciated!
    >>
    >>One thought I'll try now: Can I loop through the rows collection, check
    >>id's, and then show/hide by current index?
    >>
    >>Thanks!
    >>
    >>Matt

    >
    >
    >
     
    MattB, Mar 9, 2005
    #3
    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. luna

    Hiding table rows .asp

    luna, Jan 17, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    455
  2. Garg
    Replies:
    2
    Views:
    1,373
    Eliyahu Goldin
    Feb 15, 2007
  3. chris f

    Hiding rows in an ASP.NET table

    chris f, Jun 11, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    1,741
    Munna
    Jun 11, 2008
  4. Rick Measham

    Hiding multiple rows in a dynamic table

    Rick Measham, Sep 23, 2003, in forum: Javascript
    Replies:
    1
    Views:
    263
    Martin Honnen
    Sep 23, 2003
  5. F. Da Costa

    Hiding rows in a table via <div>

    F. Da Costa, Dec 3, 2003, in forum: Javascript
    Replies:
    8
    Views:
    213
    F. Da Costa
    Dec 5, 2003
Loading...

Share This Page