Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i created button controls dynamically and added to panel control in asp.net through coding. How to fire click events for that button controls
Posted

1 solution

You must register the OnClick events for each button before rendering them.
Button b=new Buttons();
b.Click += new EventHandler(b_Click);


C#
void b_Click(object sender, EventArgs e)
        {
            //...................do what you want here....

        }


Of course you can register all your buttons to the same handler if they will do the same functionality, and recoginze each one using the sender object in the handler.
 
Share this answer
 
v2

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