protected void gvwPlanDetail_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string status = e.Row.Cells[4].Text;
if (status.ToLower() == "ACCEPTED".ToLower())
{
ImageButton btnCancel = new ImageButton();
btncancel.id="img1"
btnCancel.ImageUrl = "..\\images\\Cancel_New.gif";
btnCancel.ToolTip = "Cancel Scheme";
btnCancel.Click +=new ImageClickEventHandler(btnCancel_Click);
e.Row.Cells[4].Controls.Add(img1);
}
}
}
here i am addinng btnCancel_Click this method
code in this method are
protected void btnCancel_Click(object sender, ImageClickEventArgs e)
{
GridViewRow gridViewRow = (GridViewRow)(sender as Control).Parent.Parent;
int index = gridViewRow.RowIndex;
objClients.ClientCode = gvwPlanDetail.Rows[index].Cells[0].Text;
objClients.SchemeName = gvwPlanDetail.Rows[index].Cells[1].Text;
objClientBase.CancelPlan(objClients);
BindGvwPlanDetail();
}