Show the `TemplateField` where Cookies condition

Hi there, I need your appreciated help.

My problem is show always to all the GridView and the column HeaderText=“Image” show exclusively for the users with Cookies is not ‘null’ and have 1 value.

I follow this approch: would be to give a HeaderText for TemplateField, say Image, and then find using that and try this code.

I don’t have error but the TemplateField Image is always visible.

Thanks for your time and hints.

<script runat="server">
public void Page_Load (Object sender, EventArgs e)
    OdbcConnection myConnectionString = new OdbcConnection(


    lblMessage.Text = "";

    if (Request.Cookies["name"] != null)
        string fld = Request.Cookies["name"].Value;
        Response.Write("My Cookie is ...<br>");
        Response.Write(fld + "<br>");

        Response.Write("Cookie not valid ...<br>");


protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)

             .Where(fld => fld.HeaderText == "Image")
    ).Visible = false;

<asp:TemplateField HeaderText="Image">

      <asp:ImageButton ID="ImageButton1" CommandName="Edit" Runat="Server"
      ImageUrl="/Images/edit.gif" ToolTip="edit"
      OnClientClick="return confirm('Confirm?.');" />

      <asp:ImageButton ID="ImageButton2" CommandName="Update" Runat="Server"
      ImageUrl="/Images/update.gif" ToolTip="update"
      OnClientClick="return confirm('Confirm?.');" />

      <asp:ImageButton ID="ImageButton3" CommandName="Delete" Runat="Server"
      ImageUrl="/Images/delete.gif" ToolTip="delete"
      OnClientClick="return confirm('Confirm?.');" />