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.
 

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

Back
Top