owl

Monday, October 5, 2009

How to handle Click event in dynamically generated linkbutton

protected void Page_Load(object sender, EventArgs e)
{
LinkButton lnkbtn = new LinkButton();
lnkbtn.Text = "Link";
lnkbtn.Click += new System.EventHandler(this.LinkButton_Click);
lnkbtn.Visible = true;
ph01.Controls.Add(lnkbtn);
}

protected void LinkButton_Click(object sender, EventArgs e)
{
Response.Write("Jayaraman");
}

No comments: