Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > tablecell with onclick in .net??

Reply
Thread Tools

tablecell with onclick in .net??

 
 
rem
Guest
Posts: n/a
 
      04-26-2004
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
 
Reply With Quote
 
 
 
 
kdub
Guest
Posts: n/a
 
      04-26-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) m...
> 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



 
Reply With Quote
 
 
 
 
rem
Guest
Posts: n/a
 
      04-28-2004
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" <(E-Mail Removed)> wrote in message news:<#(E-Mail Removed)>...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) m...
> > 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Overriding an onclick with another onclick tomlong@gmail.com Javascript 4 01-26-2006 09:26 PM
button.onclick = new Function("func2()") + button.onclick foldface@yahoo.co.uk Javascript 2 09-26-2005 08:13 AM
TableCell oTableCell = new TableCell(); noWrap? Brian K. Williams ASP .Net 2 04-30-2004 12:04 AM
Set TableCell onclick event dynamically Diane Yocom ASP .Net 0 04-15-2004 08:18 PM
document.onclick=doIt() same as document.onclick=doIt ? bob Javascript 3 08-21-2003 12:14 PM



Advertisments