Hi,
I am working on a app where i need to get the click event of a button in gridview. I am not getting it in row command may be because i am adding it dynamically as follows:
protected void gviewTemplate_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[1].Text != e.Row.Cells[2].Text)
{
e.Row.BackColor = System.Drawing.Color.Red;
LinkButton lbtnReload = new LinkButton();
lbtnReload.CommandArgument = e.Row.Cells[12].Text;
lbtnReload.Attributes.Add("onclick", "javascript:ShowDiv()");
lbtnReload.CommandName = "reload";
lbtnReload.Text = "Reload";
e.Row.Cells[1].Controls.Add(lbtnReload);
DataTable dt = (DataTable)ViewState["update"];
DataRow dr = dt.NewRow();
dr["id"] = e.Row.Cells[0].ToString();
dr["image"] = e.Row.Cells[1].ToString();
dt.Rows.Add(dr);
}
}
}
protected void gviewTemplate_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "reload")
{
hdnfield.value = int.Parse(e.CommandArgument.ToString());
}
btnFuImage.Visible = true; fuploadImage.Visible = true;
}
I have displlayed it in gridview in following manner
<asp:BoundField ItemStyle-Width="100" DataField="Uploded" HeaderText="Uploaded Image" >
I need to get values from first column of this grid and update it into some hidden variable so that i can use it later. How will i do it. Thanks in advance