Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to create dynamic button and add in panel or div and give open link in button click ?
Posted

1 solution

Did you try anything at all?

Steps:
1. Create a button
C#
Button myButton = new Button();
myButton.ID = "myButton";
myButton.Text = "Click Me!";


2. Add the event handler to button
C#
myButton.Click += new EventHandler(myButton_Click);


3. Add button to a panel or div
C#
myPanel.Controls.Add(myButton);


4. Define a button handler in code behind from before
C#
protected void myButton_Click(object sender, EventArgs e)
{
   // Open a link or do whatever you like!
}


Try!
 
Share this answer
 
Comments
_Amy 29-Jun-12 4:41am    
My +5.. Good advise for beginners.
--Amit

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