ASP.Net C# Where ID equals Cell
<p>Hi all I have this statement:</p>

<pre><code>cmd = new SqlCommand("UPDATE Comments SET Flagged = '" + "Yes" + "' WHERE Comment_ID ='" + Row.Cells[0] + "'", con);
</code></pre>

<p>Visual Studio is underlining Row.Cells[0] saying Row does not exist in current context. </p>

<p>Could you take a look and see where I am going wrong.</p>

<p>Full method Code:</p>

<pre><code>protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {

       GridView1.RowCommand += new GridViewCommandEventHandler(GridView1_RowCommand);
        if (e.CommandName == "cmdFlag")
        {
        con.Open();

        cmd = new SqlCommand("UPDATE Comments SET Flagged = '" + "Yes" + "' WHERE Comment_ID ='" + Row.Cells[0] + "'", con);

        cmd.ExecuteNonQuery();

        Response.Redirect("~/renteronly/flagset.aspx");
        }
}
</code></pre>
