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.
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.
Govinda Rajulu YemineniPosted Jul 27, 2015, 1:23 AM
protected void gvPkgcbndate_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton lnk = new LinkButton();
lbtn.Text = "lnk";
lbtn.Click += new EventHandler(lnk_Click);
e.Row.Cells[0].Controls.Add(lnk);
}
}
Manas MohapatraPosted Jul 27, 2015, 12:42 AM
{
LinkButton lnk = new LinkButton();
lnk.ID = "lnk";
lnk.Text = "click here";
lnk.Click += new System.EventHandler(lnk_Click);
}