making a table invisible

  • Thread starter Thread starter Carlos
  • Start date Start date
C

Carlos

Hi all,

I have a table that I would like to make it invsible depending on the
validity of data retrieved. The problem is that within the code behind
the reference to the table is not understood. (i.e. it says that the
html control that I reference with its ID is not declared). How can I
reference it,
and make it invisible ?

Thanks in advance,

Carlos
 
I have a table that I would like to make it invsible depending on the
validity of data retrieved. The problem is that within the code behind
the reference to the table is not understood. (i.e. it says that the
html control that I reference with its ID is not declared). How can I
reference it, and make it invisible ?

DO NOT set the table's Visible property in code-behind! That will not hide
the table - it will stop it even being rendered to the browser.

Instead, you need to set its visibility style in client-side JavaScript, as
follows:

document.getElementById("<tableID>").style.display="none";

or

document.getElementById("<tableID>").style.display="block";

to make it visible again.

Be aware, though, that some browsers don't understand the display style, so
you may need to use the visibility style instead - there are loads of Google
articles about this...
 
it always worked for me, and I have a lot of web pages with that :-)

Well good for you!

It doesn't alter the fact that setting a control's server-side Visible
property to false prevents that control from even being rendered to the
browser.

No doubt to you this looks as if you've hidden the control, but it's not the
same thing at all...
 
you right, but the I use Firefox

Oh for heaven's sake!

Do all your clients use FireFox too?

What about the poor unfortunates who use Opera...? Or Safari? Or Konqueror
on Linux?

Who gives a damn about them, right...?
 
Back
Top