Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my application i m dynamically create label and linkbutton. label shows the database value and link button is used to delete record of label value. but i dont know how to write code on
LinkButton_Click event
which is created dyanmically.
Posted

LinkButton_Click event when linkbutton created dynamically
LinkButton is created dynamically, but you might be knowing what the click would do - write the event before hand and refer/bind this event at the time of creating the linkbutton. Alternatively, you can also create anonymous method at the time of creation for the event.
 
Share this answer
 
Comments
VJ Reddy 6-Jun-12 5:30am    
Good answer. 5!
C#
protected void Page_Load(object sender, EventArgs e)
{
    LinkButton taha = new LinkButton();
    taha.Text = "Click On Me";
    taha.Click +=LinkClick;
    Panel1.Controls.Add(taha);

}

protected void LinkClick(object sender, EventArgs e)
{
    Response.Write("Hello");
}
 
Share this answer
 

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