Hide/Show ASP Tables

Discussion in 'ASP.NET 2.0' started by zoots, Nov 3, 2010.

  1. Hello everyone!

    I have 2 ASP tables (Table ID:Table1 & Table2) & I am trying to Hide/Show one of them based on a criteria. If Table 1 has data in the asp labels, then to hide Table 2. Although if Table 1 labels are empty, then to Hide table 1 and only show Table 2. Is this possible ?

    Thanks
     
  2. ...Without looking at your project I'd have to say yes it is possible.
    With each of the areas you display records you can have a check for records existing.
    Declare a dim to each case, table 1 > 0 dim1 = true, etc.
     
  3. I am trying to achieve this by using C# code & not VB. you mentioned the different cases though. What would be the cases?the tables? How do I have a check for the existing records?
     
  4. ...I was just giving an example of the possible flow not actual code.
    In your page you could create functions, which would only be used when needed.
    The tables wouldn't need to change, you can run SQL from those functions.
    Do your best to include Table field names when you do a SELECT with this.
    Don't run "SELECT *" from your code to return values or do checks.

    So let's say you have a function that checks for records...
    And you have a data list on your page that will display those records if they exist...
    Use the properties for the controls to display them if records exist.
    Otherwise the control is hidden.

    Make sense?
     
  5. I managed to work it out. I just played around with the table properties and figured it out.

    Thanks for all your help
     
  6. Good job ;-)
     

Share This Page