Solved

Hiding an HTML table row in run-time

Posted on 2004-10-17
7
611 Views
Last Modified: 2008-02-26
Experts, I have the usual HTML table, and I want to hide/re-display some of its <tr> in the run-time. How do I do this?

Of course I'm asking how to do this in ASP.Net

Thanks for your time,

James
0
Comment
Question by:James_fl
7 Comments
 
LVL 20

Assisted Solution

by:ihenry
ihenry earned 100 total points
Comment Utility
Add attribute runat="server" to each of TR tag you want to hide/display programmatically and in code behind just set its visible property to false/true

<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="300" border="1">
      <TR runat="server" id="row1">
            <TD></TD>
            <TD></TD>
            <TD></TD>
      </TR>
      <TR runat="server" id="row2">
            <TD></TD>
            <TD></TD>
            <TD></TD>
      </TR>
      <TR>
            <TD></TD>
            <TD></TD>
            <TD></TD>
      </TR>
</TABLE>
'---
row1.Visible = False
row2.Visible = True
0
 
LVL 18

Accepted Solution

by:
tusharashah earned 400 total points
Comment Utility
Right click your Table & make it RunAsServer Control..

then you can simply access any row of that table in code behind liek

Table1.Rows[1].Visible = false;

-tushar
0
 
LVL 63

Expert Comment

by:Zvonko
Comment Utility
You did not state on what condition or on what user action you want the row display state to toggle.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:James_fl
Comment Utility
Points given. However, tusharashah gets most points since I tried the first solution and it didn't work unless I have the table as a server control.
0
 

Author Comment

by:James_fl
Comment Utility
Thanks btw
0
 
LVL 20

Expert Comment

by:ihenry
Comment Utility
Hi James

You wanted to toggle display state of some tr[s] but not all, that's why I offered you my suggestion. And I'm very sure it can work very well with your requirement. The only mistake, I guess, I didn't mention explicitly that you need to declare the two variable row1 and row2 in your class. Anyway, tushar is worth more points since you can get his solution working :o)

Cheers!
0
 

Author Comment

by:James_fl
Comment Utility
cheers ihenry, i'll try doing that. Thank you for your help :D
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now