Can I hide a <TABLE>?

Discussion in 'ASP .Net' started by =?Utf-8?B?QW5keQ==?=, Mar 24, 2005.

  1. Hi,
    In my app I have used HTML tables to aid with the layout of the site. i want
    some tables only to be viewed by some roles.
    e.g. I have a table called tblAdmin, but when I reference this table in code
    (to make it visible) I get
    "the type or namespace name 'tblAdmin' could not be found..."

    Does this mean that I cannot use HTML TABLE's for what I'm doing? i.e. make
    them visible or not programatically

    Many thanks.
    Andy
     
    =?Utf-8?B?QW5keQ==?=, Mar 24, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?QW5keQ==?=

    Teemu Keiski Guest

    If you have declared it with runat="server" attribute, you can access it and
    change visibility from server-side code.

    <table id="Table1" runat="server">
    ....
    </table>

    'Code to set visibility (e.g is the control rendered)
    Table1.Visible = False

    --
    Teemu Keiski
    ASP.NET MVP, Finland



    "Andy" <> wrote in message
    news:...
    > Hi,
    > In my app I have used HTML tables to aid with the layout of the site. i
    > want
    > some tables only to be viewed by some roles.
    > e.g. I have a table called tblAdmin, but when I reference this table in
    > code
    > (to make it visible) I get
    > "the type or namespace name 'tblAdmin' could not be found..."
    >
    > Does this mean that I cannot use HTML TABLE's for what I'm doing? i.e.
    > make
    > them visible or not programatically
    >
    > Many thanks.
    > Andy
     
    Teemu Keiski, Mar 24, 2005
    #2
    1. Advertising

  3. =?Utf-8?B?QW5keQ==?=

    Vladimir V Guest

    Try to make it runat=server

    "Andy" <> wrote in message
    news:...
    > Hi,
    > In my app I have used HTML tables to aid with the layout of the site. i

    want
    > some tables only to be viewed by some roles.
    > e.g. I have a table called tblAdmin, but when I reference this table in

    code
    > (to make it visible) I get
    > "the type or namespace name 'tblAdmin' could not be found..."
    >
    > Does this mean that I cannot use HTML TABLE's for what I'm doing? i.e.

    make
    > them visible or not programatically
    >
    > Many thanks.
    > Andy
     
    Vladimir V, Mar 24, 2005
    #3
  4. Found it - put it in a panel.

    Ho hum.

    "Andy" wrote:

    > Hi,
    > In my app I have used HTML tables to aid with the layout of the site. i want
    > some tables only to be viewed by some roles.
    > e.g. I have a table called tblAdmin, but when I reference this table in code
    > (to make it visible) I get
    > "the type or namespace name 'tblAdmin' could not be found..."
    >
    > Does this mean that I cannot use HTML TABLE's for what I'm doing? i.e. make
    > them visible or not programatically
    >
    > Many thanks.
    > Andy
     
    =?Utf-8?B?QW5keQ==?=, Mar 24, 2005
    #4
  5. =?Utf-8?B?QW5keQ==?=

    Hans Kesting Guest

    Andy wrote:
    > Hi,
    > In my app I have used HTML tables to aid with the layout of the site. i want
    > some tables only to be viewed by some roles.
    > e.g. I have a table called tblAdmin, but when I reference this table in code
    > (to make it visible) I get
    > "the type or namespace name 'tblAdmin' could not be found..."
    >
    > Does this mean that I cannot use HTML TABLE's for what I'm doing? i.e. make
    > them visible or not programatically
    >
    > Many thanks.
    > Andy


    I take it that the table has an ID "tblAdmin"? Then you are halfway
    there: Add a "runat='server'" as well. If you then switch to designmode
    and back, the declaration is added to the codebehind.

    --
    Hans Kesting
     
    Hans Kesting, Mar 24, 2005
    #5
    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. David Williams
    Replies:
    2
    Views:
    1,137
    Jacob Yang [MSFT]
    Aug 12, 2003
  2. RA
    Replies:
    1
    Views:
    3,991
  3. David
    Replies:
    4
    Views:
    5,967
    Vidar Petursson
    May 21, 2004
  4. Rio
    Replies:
    4
    Views:
    1,202
  5. Replies:
    6
    Views:
    222
Loading...

Share This Page