To create dynamic link button then use the following code which will remain same to make any control in asp.net. I have tested on many of them. And lastly don’t forget to add the same to the form of the asp.net page otherwise it will through an error. Then code for that is as follows.
|C# |||copy code |||?|
protected void Page_Load(object sender, EventArgs e)
//here we are creating on page load event so link will appear as the page is loaded
LinkButton LnkBtn = new LinkButton();
LnkBtn.ID = "LinkButton1"; //assigning a ID;
LnkBtn.Text = "LinkButton";//adding default text
form1.Controls.Add(LnkBtn);//add the LinkButton to the form
Above code will exactly create the same link button which you will get on drag and drop of the link button from the tool panel.