Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Adding events to TableCells

Reply
Thread Tools

Adding events to TableCells

 
 
Mark Rae
Guest
Posts: n/a
 
      11-17-2005
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


 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      11-17-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      11-17-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      11-17-2005
"Eliyahu Goldin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> 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?


 
Reply With Quote
 
S.M. Altaf [MVP]
Guest
Posts: n/a
 
      11-17-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      11-17-2005
"S.M. Altaf [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> 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...


 
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
dynamically adding controls with events (but events are not firing) SevDer ASP .Net 2 11-13-2007 06:33 AM
Events Events Events Please Help Chris ASP .Net Web Controls 0 08-30-2005 08:21 PM
Building Dynamic tablecells gane kol ASP .Net 1 03-17-2005 01:46 PM
Extra space after asp:tablecells? Diane Yocom ASP .Net 0 04-15-2004 09:48 PM
how to aign text in tablecells using css-file Hugo de Payns HTML 5 10-02-2003 02:43 PM



Advertisments