Adding events to TableCells

M

Mark Rae

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
 
K

Kevin Spencer

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
 
E

Eliyahu Goldin

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
 
M

Mark Rae

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?
 

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,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top