tablecell with onclick in .net??

R

rem

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
 
K

kdub

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
 
R

rem

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
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top