tablecell with onclick in .net??

Discussion in 'ASP .Net Web Controls' started by rem, Apr 26, 2004.

  1. rem

    rem Guest

    In HTML 4, I used to do this:
    <table>
    <tr><td onclick="myFunction">Click here</td></tr>
    </table>
    using table for some funky layout tech.


    How can I do the same thing with <asp:table runat="server">
    where the myFunction is placed in a code-behing file. or something
    equivalent in asp.NET.

    It works when myFunction is in a script tag in the aspx, but it's not
    want I wanna do.

    Big thanks

    rem
     
    rem, Apr 26, 2004
    #1
    1. Advertising

  2. rem

    kdub Guest

    From what I know, any event in asp.net is actually 'initiated' by a
    javascript call on the client. YOu could add an attribute to the tablecell
    to call a client-side js function that first sets a flag saying which cell
    was clicked then posts back to the server. The server would then look for
    that flag. (You can look at the

    You can easily take advantage of the standard ASP.NET postback function:

    function __doPostBack(eventTarget, eventArgument)


    Maybe this will get you going while someone smarter has time to reply.

    Kevin


    "rem" <> wrote in message
    news:...
    > In HTML 4, I used to do this:
    > <table>
    > <tr><td onclick="myFunction">Click here</td></tr>
    > </table>
    > using table for some funky layout tech.
    >
    >
    > How can I do the same thing with <asp:table runat="server">
    > where the myFunction is placed in a code-behing file. or something
    > equivalent in asp.NET.
    >
    > It works when myFunction is in a script tag in the aspx, but it's not
    > want I wanna do.
    >
    > Big thanks
    >
    > rem
     
    kdub, Apr 26, 2004
    #2
    1. Advertising

  3. rem

    rem Guest

    thanks for your answer, but I wanna avoid postback until it stay as
    the ONLY solution.

    I found a trick to simulate the clickable cell.
    I kept the table layout but used a asp:button in it with the same size
    as the cell, but with transparent color.

    Therefore, nobody can tell that you are clicking on a button.
    But another problem occur: if the text in the button is too long, you
    can't have it on two row.
    Like this:

    |---------|
    |Click on |
    |me please|
    |---------|

    Is there a way to have the text on two row(for a asp:button)?

    thanks


    "kdub" <> wrote in message news:<#>...
    > From what I know, any event in asp.net is actually 'initiated' by a
    > javascript call on the client. YOu could add an attribute to the tablecell
    > to call a client-side js function that first sets a flag saying which cell
    > was clicked then posts back to the server. The server would then look for
    > that flag. (You can look at the
    >
    > You can easily take advantage of the standard ASP.NET postback function:
    >
    > function __doPostBack(eventTarget, eventArgument)
    >
    >
    > Maybe this will get you going while someone smarter has time to reply.
    >
    > Kevin
    >
    >
    > "rem" <> wrote in message
    > news:...
    > > In HTML 4, I used to do this:
    > > <table>
    > > <tr><td onclick="myFunction">Click here</td></tr>
    > > </table>
    > > using table for some funky layout tech.
    > >
    > >
    > > How can I do the same thing with <asp:table runat="server">
    > > where the myFunction is placed in a code-behing file. or something
    > > equivalent in asp.NET.
    > >
    > > It works when myFunction is in a script tag in the aspx, but it's not
    > > want I wanna do.
    > >
    > > Big thanks
    > >
    > > rem
     
    rem, Apr 28, 2004
    #3
    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. Diane Yocom

    Set TableCell onclick event dynamically

    Diane Yocom, Apr 15, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    8,574
    Diane Yocom
    Apr 15, 2004
  2. Brian K. Williams

    TableCell oTableCell = new TableCell(); noWrap?

    Brian K. Williams, Apr 30, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,531
    Brian K. Williams
    Apr 30, 2004
  3. Svein Terje Gaup
    Replies:
    0
    Views:
    8,059
    Svein Terje Gaup
    Sep 15, 2004
  4. bob
    Replies:
    3
    Views:
    189
  5. Replies:
    2
    Views:
    261
Loading...

Share This Page