making a table invisible

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
 
M

Mark Rae

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...
 
M

Mark Rae

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...
 
M

Mark Rae

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...?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top