Hide Table with OnClick

Discussion in 'ASP .Net' started by Phillip Vong, Jul 11, 2006.

  1. Phillip Vong

    Phillip Vong Guest

    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
    Phillip Vong, Jul 11, 2006
    #1
    1. Advertising

  2. Phillip Vong

    Guest

    <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, 2006
    #2
    1. Advertising

  3. Phillip Vong

    Aemca Guest

    "Phillip Vong" <phillip_vong*at*yahoo*dot*com> wrote in message
    news:...
    > 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
    Aemca, Jul 11, 2006
    #3
  4. Phillip Vong

    Guest

    or do you mean when the table itself is clicked?




    Aemca wrote:
    > "Phillip Vong" <phillip_vong*at*yahoo*dot*com> wrote in message
    > news:...
    > > 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, 2006
    #4
  5. 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
    Richard Carpenter, Jul 11, 2006
    #5
  6. Phillip Vong

    Phillip Vong Guest

    Thanks for the reply. I've already tried that and it's telling me table1 is
    not defined.


    <> wrote in message
    news:...
    > <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

    >
    Phillip Vong, Jul 11, 2006
    #6
  7. Phillip Vong

    Phillip Vong Guest

    I'm not talking about clicking the table. Just the button. When I give the
    <table id=table1 runat=server> and 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.


    <> wrote in message
    news:...
    > or do you mean when the table itself is clicked?
    >
    >
    >
    >
    > Aemca wrote:
    >> "Phillip Vong" <phillip_vong*at*yahoo*dot*com> wrote in message
    >> news:...
    >> > 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

    >
    Phillip Vong, Jul 11, 2006
    #7
  8. 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
    Richard Carpenter, Jul 11, 2006
    #8
  9. Phillip Vong

    Guest

    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=server> and 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.
    >
    >
    > <> wrote in message
    > news:...
    > > or do you mean when the table itself is clicked?
    > >
    > >
    > >
    > >
    > > Aemca wrote:
    > >> "Phillip Vong" <phillip_vong*at*yahoo*dot*com> wrote in message
    > >> news:...
    > >> > 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, 2006
    #9
  10. Phillip Vong

    Guest

    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=server> and 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.
    >
    >
    > <> wrote in message
    > news:...
    > > or do you mean when the table itself is clicked?
    > >
    > >
    > >
    > >
    > > Aemca wrote:
    > >> "Phillip Vong" <phillip_vong*at*yahoo*dot*com> wrote in message
    > >> news:...
    > >> > 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, 2006
    #10
  11. Phillip Vong

    Phillip Vong Guest

    The table is in the CONTENT and I would like to do it from the server side.
    Thanks!


    <> wrote in message
    news:...
    > 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=server> and 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.
    >>
    >>
    >> <> wrote in message
    >> news:...
    >> > or do you mean when the table itself is clicked?
    >> >
    >> >
    >> >
    >> >
    >> > Aemca wrote:
    >> >> "Phillip Vong" <phillip_vong*at*yahoo*dot*com> wrote in message
    >> >> news:...
    >> >> > 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
    >> >

    >
    Phillip Vong, Jul 11, 2006
    #11
    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. bob
    Replies:
    3
    Views:
    179
  2. Daniel H.

    form button onclick and hide result

    Daniel H., Apr 30, 2004, in forum: Javascript
    Replies:
    5
    Views:
    134
    Thomas 'PointedEars' Lahn
    May 20, 2004
  3. Replies:
    2
    Views:
    243
  4. Replies:
    4
    Views:
    168
  5. Replies:
    6
    Views:
    211
Loading...

Share This Page