narasiman rao

narasiman rao

  • NA
  • 519
  • 767k

dynamically created link button event is not firing

Jul 26 2015 10:49 PM
 
 n Gridview run mode as follows

SelectedBatchdate
27 May 2015
30 May 2015
5 June 2015
Click Here (Link button)

i written the code in gridview_databound as follows

protected void gvPkgcbndate_DataBound(object sender, EventArgs e)
{
LinkButton lnk = new LinkButton();
lnk.ID = "lnk";
lnk.Text = "click here";
lnk.Click += new System.EventHandler(lnk_Click);
}

protected void lnk_Click(object sender, EventArgs e)
{
Response.Write("you are selected the link button");
}

When user click the click here link button, the message not shown "you are selectedt eh link button";

Link button selected event is not firing.


please help me. what is the mistake i made in my above code. 

Answers (2)