narasiman rao

narasiman rao

  • NA
  • 519
  • 745.6k

Link button event is called please help me i triedseveraltim

Jul 27 2015 7:58 AM
in run mode in gridview as follows

Studentid
30

i write the code as follows
protected void gvPkgcbndate_RowDataBound(Object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[0].Text == "30")
{
var firstCell = e.Row.Cells[0];
firstCell.Controls.Clear();
LinkButton lnk_Check = new LinkButton();
lnk_Check.ID ="lnk_Check";
lnk_Check.Text = firstCell.Text;
lnk_Check.Click += new EventHandler(lnk_Check_Click);
firstCell.Controls.Add(lnk_Check);
e.Row.Cells[0].Controls.Add(lnk_Check);
lnk_Check.Attributes.Add("onClick",return false;");

}
}
}

protected void lnk_Check_Click(object sender, EventArgs e)
{
Response.Write("Link click event is called");
}

In run mode when i click the student id 30 i want to show the message as follows
Link click event is called.


please help me. what is the mistake i made.
i tried several times but when i click the link button in girdview the message not showm

Link button click event is not fired.

Answers (1)