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

Adding events to TableCells

P: n/a
Hi,

Is it possible to add events, specifically a Click event, to a dynamically
created TableCell?

I have an <asp:Table...> control to which I'm dynamically adding TableRow
controls made up of TableCell controls - before you ask, the underlying data
is really not suitable for a DataGrid or Repeater...

Now, the client is asking for each dynamically added TableCell control to
respond to a server-side Click event - is this possible?

Mark
Nov 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Sort of, yes. The problem is not adding the event to a table cell; it is
adding the event to a TableCell object instance. Since you're using a Table
WebControl, this event is not part of the object model. It *is* part of the
HTML Document Object Model supported by all (at least that I know of)
browsers.

So, what you need to do is to create a class that inherits TableCell, and
define a server click event for it. Then use that in your Table Control.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition
"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:O2**************@TK2MSFTNGP14.phx.gbl...
Hi,

Is it possible to add events, specifically a Click event, to a dynamically
created TableCell?

I have an <asp:Table...> control to which I'm dynamically adding TableRow
controls made up of TableCell controls - before you ask, the underlying
data is really not suitable for a DataGrid or Repeater...

Now, the client is asking for each dynamically added TableCell control to
respond to a server-side Click event - is this possible?

Mark

Nov 20 '05 #2

P: n/a
Mark,

TableCell doesn't support server-side onclick event (at least it is not
listed). What about adding a client-side onclick event that will submit the
page?

Eliyahu

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:O2**************@TK2MSFTNGP14.phx.gbl...
Hi,

Is it possible to add events, specifically a Click event, to a dynamically
created TableCell?

I have an <asp:Table...> control to which I'm dynamically adding TableRow
controls made up of TableCell controls - before you ask, the underlying
data is really not suitable for a DataGrid or Repeater...

Now, the client is asking for each dynamically added TableCell control to
respond to a server-side Click event - is this possible?

Mark

Nov 20 '05 #3

P: n/a
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:uo**************@TK2MSFTNGP11.phx.gbl...
TableCell doesn't support server-side onclick event (at least it is not
listed). What about adding a client-side onclick event that will submit
the page?


Yes, but will I be able to wire the postback up server-side?
Nov 20 '05 #4

P: n/a
This URL shows you how to force a postback to occur on a page.

http://weblogs.asp.net/mnolton/archi...6/04/8260.aspx

http://www.mredkj.com/vbnet/textboxt...dpostback.html

You can modify the code for your purpose by adding an attribute for onClick
to your table cell.

HTH
Altaf
--------------------------------------------------------------------------------
All that glitters has a high refractive index.
www.mendhak.com
"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:O2**************@TK2MSFTNGP14.phx.gbl...
Hi,

Is it possible to add events, specifically a Click event, to a dynamically
created TableCell?

I have an <asp:Table...> control to which I'm dynamically adding TableRow
controls made up of TableCell controls - before you ask, the underlying
data is really not suitable for a DataGrid or Repeater...

Now, the client is asking for each dynamically added TableCell control to
respond to a server-side Click event - is this possible?

Mark

Nov 20 '05 #5

P: n/a
"S.M. Altaf [MVP]" <sm*****@PLEASEDONTSPAMMEmsn.com> wrote in message
news:Oq**************@TK2MSFTNGP11.phx.gbl...
This URL shows you how to force a postback to occur on a page.

http://weblogs.asp.net/mnolton/archi...6/04/8260.aspx

http://www.mredkj.com/vbnet/textboxt...dpostback.html

You can modify the code for your purpose by adding an attribute for
onClick to your table cell.


Perfect! Thanks... :-)
Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.