Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp:TableRow wrapped in DIV

Status
Not open for further replies.

jonbatts

Programmer
Apr 12, 2005
114
US
I'm dynamically creating a table with rows of 4 different statuses. I'm using an asp:table and adding rows programmatically. Like this (generically)
Code:
TableCell tc = new TableCell();
tc.Text = "1";
TableRow tr = new TableRow();
tr.Cells.Add(tc);
tblMyTable.Rows.Add(tr);
What I'm going to write is a function which shows and hides rows based on their status. i.e. 4 toggle buttons: "Show/Hide Status1", "Show/Hide Status2", "Show/Hide Status3", and "Show/Hide Status4". In order to do this in Javascript I was planning on wrapping each row in a div tag, such that the output html looks something like this
Code:
<table>
    <div id="Row1">
        <tr>
            <td>Item1</td>
        </tr>
    </div>
    <div id="Row2">
        <tr>
            <td>Item2</td>
        </tr>
    </div>
    <div id="Row3">
        <tr>
            <td>Item3</td>
        </tr>
    </div>
    <div id="Row4">
        <tr>
            <td>Item4</td>
        </tr>
    </div>
</table>
Then in Javascript, depending on which button is pressed I can show or hide the divs. The problem is I'm not sure how (or if it's even possible) to wrap an asp:TableRow in a div. Can this be done, or is there another solution. Thanks, and have a great day.
 
Can this be done
No, it's not valid HTML. I'm not sure why you think you need a div tag though? WHy can't you just target the relevant rows to hide/show them?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
ca8msm, I CAN target the relevant rows. I'm not sure why I thought I needed a div tag either. :) What I'm doing now is assigning each tablerow an id and using [tt]document.getElementById('tableRowID').style.display = "[block/none]";[/tt] It works just fine. Thanks for your time and help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top