Adding a onclick event to a code generated html element via object initializer

Posted by mwright on Stack Overflow See other posts from Stack Overflow or by mwright
Published on 2010-03-19T16:49:17Z Indexed on 2010/03/19 16:51 UTC
Read the original article Hit count: 184

Filed under:
|
|

I would like to be able to add a click event to a entity generated in the code behind. Currently I'm doing it like this:

 TableRow row = new TableRow();
 row.Attributes.Add("onclick", "clickFunction(this)");

Is there a way to do this using the object initializer? I am doing a lot of control creation/initialization and if it matched the rest of the code it would be nice

© Stack Overflow or respective owner

Related posts about c#

Related posts about objectinitalizer