ASPNET control dynamic event handling

  • Thread starter Thread starter Jason Huang
  • Start date Start date
J

Jason Huang

Hi,

In my ASPNET 2.0 web form application, I have a Table control T1 which
contains some LinkButton controls.
But we don't know the number of the LinkButton yet, cuz the number of the
LinkButton is based on the SQL query during the run time.
My question is how do we handle those Click event for those nucertain number
LinkButtons?
Thanks for help.


Jason
 
Jason,

You can set the event handler to the same handler (method), and then
check the sender parameter to see which button fired the event. Of course,
that means that in creating your button dynamically, you will have to set
some property on the button that will allow you to distinguish it.
 
Back
Top