By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,925 Members | 732 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,925 IT Pros & Developers. It's quick & easy.

Hide Table with OnClick

P: n/a
Newbie here on ASP.NET

I want to hide a Table with and OnClick event. How do you do that? I'm not
showing an ID when I create a table so how do I tell it to hide it? Is
there a way to add an ID to a table? If so, how do you hide it. Please
give it to me in a format like you would for a Label (label1.visible =
False)

Thanks in advance

Phil
Jul 11 '06 #1
Share this Question
Share on Google+
10 Replies


P: n/a
<script runat="server" language="C#">

protected void Button1_Click(object sender, EventArgs e)
{
table1.Visibile = false;
}

</script>

<table id="table1" runat="server"></table>
<asp:button id="Button1" runat="server" onclick="Button1_Click" />

Phillip Vong wrote:
Newbie here on ASP.NET

I want to hide a Table with and OnClick event. How do you do that? I'm not
showing an ID when I create a table so how do I tell it to hide it? Is
there a way to add an ID to a table? If so, how do you hide it. Please
give it to me in a format like you would for a Label (label1.visible =
False)

Thanks in advance

Phil
Jul 11 '06 #2

P: n/a


"Phillip Vong" <phillip_vong*at*yahoo*dot*comwrote in message
news:ub**************@TK2MSFTNGP03.phx.gbl...
Newbie here on ASP.NET

I want to hide a Table with and OnClick event. How do you do that? I'm
not showing an ID when I create a table so how do I tell it to hide it?
Is there a way to add an ID to a table? If so, how do you hide it.
Please give it to me in a format like you would for a Label
(label1.visible = False)
If you want to do it with a server side click event go with:

<table id=table1 runat=server>

then just do:
table1.visible = false


Jul 11 '06 #3

P: n/a
or do you mean when the table itself is clicked?


Aemca wrote:
"Phillip Vong" <phillip_vong*at*yahoo*dot*comwrote in message
news:ub**************@TK2MSFTNGP03.phx.gbl...
Newbie here on ASP.NET

I want to hide a Table with and OnClick event. How do you do that? I'm
not showing an ID when I create a table so how do I tell it to hide it?
Is there a way to add an ID to a table? If so, how do you hide it.
Please give it to me in a format like you would for a Label
(label1.visible = False)

If you want to do it with a server side click event go with:

<table id=table1 runat=server>

then just do:
table1.visible = false
Jul 11 '06 #4

P: n/a
Anyone other novices do like I did and start with, "Sure, that should
be easy enough by just adding an ID and then an event
handl....wait...huh."

You can add an id to the table with the typical id="Table1" attribute
and even add an OnClick event handler with OnClick="Table1_Click", but
I don't see how to make the table accessible from the Table1_Click
event code. I'm guessing there is something different about dealing
with containers, maybe? I find it odd that OnClick is aparently
appropriate for a table, yet not implemented the same as other
clickable controls.

Rich
Phillip Vong wrote:
Newbie here on ASP.NET

I want to hide a Table with and OnClick event. How do you do that? I'm not
showing an ID when I create a table so how do I tell it to hide it? Is
there a way to add an ID to a table? If so, how do you hide it. Please
give it to me in a format like you would for a Label (label1.visible =
False)

Thanks in advance

Phil
Jul 11 '06 #5

P: n/a
Thanks for the reply. I've already tried that and it's telling me table1 is
not defined.
<ne**********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
<script runat="server" language="C#">

protected void Button1_Click(object sender, EventArgs e)
{
table1.Visibile = false;
}

</script>

<table id="table1" runat="server"></table>
<asp:button id="Button1" runat="server" onclick="Button1_Click" />

Phillip Vong wrote:
>Newbie here on ASP.NET

I want to hide a Table with and OnClick event. How do you do that? I'm
not
showing an ID when I create a table so how do I tell it to hide it? Is
there a way to add an ID to a table? If so, how do you hide it. Please
give it to me in a format like you would for a Label (label1.visible =
False)

Thanks in advance

Phil

Jul 11 '06 #6

P: n/a
Doh! runat="server" fixed the problem of it not being visible in the
Table1_Click event, but now I get a "Table1_Click has not been defined"
error on the page, even though that *is* the name of the procedure I
created.

Rich

Richard Carpenter wrote:
Anyone other novices do like I did and start with, "Sure, that should
be easy enough by just adding an ID and then an event
handl....wait...huh."

You can add an id to the table with the typical id="Table1" attribute
and even add an OnClick event handler with OnClick="Table1_Click", but
I don't see how to make the table accessible from the Table1_Click
event code. I'm guessing there is something different about dealing
with containers, maybe? I find it odd that OnClick is aparently
appropriate for a table, yet not implemented the same as other
clickable controls.

Rich
Phillip Vong wrote:
Newbie here on ASP.NET

I want to hide a Table with and OnClick event. How do you do that? I'm not
showing an ID when I create a table so how do I tell it to hide it? Is
there a way to add an ID to a table? If so, how do you hide it. Please
give it to me in a format like you would for a Label (label1.visible =
False)

Thanks in advance

Phil
Jul 11 '06 #7

P: n/a
I'm not talking about clicking the table. Just the button. When I give the
<table id=table1 runat=serverand I try table1.visible = false

It tells me table1 is not defined. Maybe I forgot to mention that I'm using
VS2005 in MasterPage and the table is in one of the contents.
<ne**********@gmail.comwrote in message
news:11**********************@35g2000cwc.googlegro ups.com...
or do you mean when the table itself is clicked?


Aemca wrote:
>"Phillip Vong" <phillip_vong*at*yahoo*dot*comwrote in message
news:ub**************@TK2MSFTNGP03.phx.gbl...
Newbie here on ASP.NET

I want to hide a Table with and OnClick event. How do you do that?
I'm
not showing an ID when I create a table so how do I tell it to hide it?
Is there a way to add an ID to a table? If so, how do you hide it.
Please give it to me in a format like you would for a Label
(label1.visible = False)

If you want to do it with a server side click event go with:

<table id=table1 runat=server>

then just do:
table1.visible = false

Jul 11 '06 #8

P: n/a
are you trying to hide it in the masterpage or in the content page?
Phillip Vong wrote:
I'm not talking about clicking the table. Just the button. When I give the
<table id=table1 runat=serverand I try table1.visible = false

It tells me table1 is not defined. Maybe I forgot to mention that I'm using
VS2005 in MasterPage and the table is in one of the contents.
<ne**********@gmail.comwrote in message
news:11**********************@35g2000cwc.googlegro ups.com...
or do you mean when the table itself is clicked?


Aemca wrote:
"Phillip Vong" <phillip_vong*at*yahoo*dot*comwrote in message
news:ub**************@TK2MSFTNGP03.phx.gbl...
Newbie here on ASP.NET

I want to hide a Table with and OnClick event. How do you do that?
I'm
not showing an ID when I create a table so how do I tell it to hide it?
Is there a way to add an ID to a table? If so, how do you hide it.
Please give it to me in a format like you would for a Label
(label1.visible = False)

If you want to do it with a server side click event go with:

<table id=table1 runat=server>

then just do:
table1.visible = false
Jul 11 '06 #9

P: n/a
you could also hide it on the client side:

<table onclick=" this.style.display = 'none' ; ">

cheers

neil
Phillip Vong wrote:
I'm not talking about clicking the table. Just the button. When I give the
<table id=table1 runat=serverand I try table1.visible = false

It tells me table1 is not defined. Maybe I forgot to mention that I'm using
VS2005 in MasterPage and the table is in one of the contents.
<ne**********@gmail.comwrote in message
news:11**********************@35g2000cwc.googlegro ups.com...
or do you mean when the table itself is clicked?


Aemca wrote:
"Phillip Vong" <phillip_vong*at*yahoo*dot*comwrote in message
news:ub**************@TK2MSFTNGP03.phx.gbl...
Newbie here on ASP.NET

I want to hide a Table with and OnClick event. How do you do that?
I'm
not showing an ID when I create a table so how do I tell it to hide it?
Is there a way to add an ID to a table? If so, how do you hide it.
Please give it to me in a format like you would for a Label
(label1.visible = False)

If you want to do it with a server side click event go with:

<table id=table1 runat=server>

then just do:
table1.visible = false
Jul 11 '06 #10

P: n/a
The table is in the CONTENT and I would like to do it from the server side.
Thanks!
<ne**********@gmail.comwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
you could also hide it on the client side:

<table onclick=" this.style.display = 'none' ; ">

cheers

neil
Phillip Vong wrote:
>I'm not talking about clicking the table. Just the button. When I give
the
<table id=table1 runat=serverand I try table1.visible = false

It tells me table1 is not defined. Maybe I forgot to mention that I'm
using
VS2005 in MasterPage and the table is in one of the contents.
<ne**********@gmail.comwrote in message
news:11**********************@35g2000cwc.googlegr oups.com...
or do you mean when the table itself is clicked?


Aemca wrote:
"Phillip Vong" <phillip_vong*at*yahoo*dot*comwrote in message
news:ub**************@TK2MSFTNGP03.phx.gbl...
Newbie here on ASP.NET

I want to hide a Table with and OnClick event. How do you do that?
I'm
not showing an ID when I create a table so how do I tell it to hide
it?
Is there a way to add an ID to a table? If so, how do you hide it.
Please give it to me in a format like you would for a Label
(label1.visible = False)

If you want to do it with a server side click event go with:

<table id=table1 runat=server>

then just do:
table1.visible = false

Jul 11 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.