I am creating one button on a page dynamically. Now I want to use the button click event on that button.
How can I do this in C# ASP.NET?
Button button = new Button(); button.Click += (s,e) => { your code; }; //button.Click += new EventHandler(button_Click); container.Controls.Add(button); //protected void button_Click (object sender, EventArgs e) { }
2.1m questions
2.1m answers
60 comments
57.0k users