How to dynamically add button in asp.net

{0 Comments}

here is a simple syntax to add button in asp.net dynamically or say from code behind. Using this you can add your custom button to the webpage

 C# |  copy code |? 
1
Button btn = new Button();
2
        btn.ID = "button1";
3
        btn.Text = "new button";
4
        form1.Controls.Add(btn);

 

Leave a Comment

Your email address will not be published.