Click here to Skip to main content
15,894,252 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
i have dynamically created button in table in my project
now, i want to link page on the click event of that button
how to link page on dynamically created button???
Posted
Comments
walterhevedeich 13-May-11 1:03am    
You may want to post your code so we will have an idea on what you are talking about

1 solution

Here is how:
C#
Button myButton = new Button();
//...

myButton.Click += (sender, eventArgs) => {
   //some call -- whatever you need on click
};

//this can work for v.2.0 as well, a bit more wordy:
myButton.Click += delegate(object sender, System.EventArgs eventArgs) {
   //some other call
};


—SA
 
Share this answer
 
Comments
Olivier Levrey 13-May-11 4:08am    
Good enough. My 5.
Sergey Alexandrovich Kryukov 13-May-11 4:47am    
Thank you, Olivier.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900