I want to disable / put it in read only mode or anything that will make it not functional forever. What i have is this:
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="btnApprove" runat="server" Text="Approve" CommandName="Approve" CommandArgument='<%# Eval("ProductID") %>' />
</ItemTemplate>
</asp:TemplateField>
And it looks like this: example image
Now what i want is when i click on the Approve link button, it will be then grayed out or lose its functionality. BUT ONLY FOR THAT ROW THAT I HAVE CLICKED .Any trick on how i can do that? by the way here is my code behind for it:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
CheckBox chkRow = (row.Cells[0].FindControl("chkCtrl") as CheckBox);
if (chkRow.Checked)
{
using (SqlConnection scn = new SqlConnection("Data Source = 'PAULO'; Initial Catalog=ShoppingCartDB;Integrated Security =True"))
{
scn.Open();
SqlCommand cmd = new SqlCommand("update o set o.Updatedproduct = p.ProductQuantity - o.Totalproduct from CustomerProducts o inner join Products p on o.ProductID = p.ProductID WHERE o.CustomerID=@CustomerID", scn);
cmd.Parameters.AddWithValue("@CustomerID", SqlDbType.Int).Value = row.Cells[0].Text;
cmd.ExecuteNonQuery();
Label1.Visible = true;
Label2.Visible = false;
GridView1.DataBind();
}
}
}
}
}
UPDATE:
based on the image i provided, i consider also having the entire row being grayed out if possible. its as if its useless after the ink button click