ASP.NET how to hide template field control based on another template field value in GridView
<p>here my code:</p>

<pre><code>&lt;asp:GridView ID="_gvPLCs" runat="server" AutoGenerateColumns="False" 
                                BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" 
                                CellPadding="4" DataSourceID="_dsPLCs" ForeColor="Black" GridLines="Horizontal" 
                                onrowcommand="_gvPLCs_RowCommand" onrowdatabound="_gvPLCs_RowDataBound"&gt;
                                &lt;Columns&gt;
                                    &lt;asp:TemplateField ShowHeader="False"&gt;
                                        &lt;ItemTemplate&gt;
                                            &lt;asp:LinkButton ID="lbnView" runat="server" CausesValidation="false" 
                                                CommandName="view" Text="View manual"&gt;&lt;/asp:LinkButton&gt;
                                        &lt;/ItemTemplate&gt;
                                    &lt;/asp:TemplateField&gt;
                                    &lt;asp:TemplateField HeaderText="PLCName" SortExpression="PLCName"&gt;
                                        &lt;ItemTemplate&gt;
                                            &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Bind("PLCName") %&gt;'&gt;&lt;/asp:Label&gt;
                                        &lt;/ItemTemplate&gt;
                                        &lt;EditItemTemplate&gt;
                                            &lt;asp:TextBox ID="TextBox1" runat="server" Text='&lt;%# Bind("PLCName") %&gt;'&gt;&lt;/asp:TextBox&gt;
                                        &lt;/EditItemTemplate&gt;
                                    &lt;/asp:TemplateField&gt;
                                    &lt;asp:TemplateField HeaderText="PLCManual" SortExpression="PLCManual"&gt;
                                        &lt;ItemTemplate&gt;
                                            &lt;asp:Label ID="Label2" runat="server" Text='&lt;%# Bind("PLCManual") %&gt;'&gt;&lt;/asp:Label&gt;
                                        &lt;/ItemTemplate&gt;
                                        &lt;EditItemTemplate&gt;
                                            &lt;asp:TextBox ID="TextBox2" runat="server" Text='&lt;%# Bind("PLCManual") %&gt;'&gt;&lt;/asp:TextBox&gt;
                                        &lt;/EditItemTemplate&gt;
                                    &lt;/asp:TemplateField&gt;
                                    &lt;asp:TemplateField HeaderText="LabName" SortExpression="LabName"&gt;
                                        &lt;ItemTemplate&gt;
                                            &lt;asp:Label ID="Label3" runat="server" Text='&lt;%# Bind("LabName") %&gt;'&gt;&lt;/asp:Label&gt;
                                        &lt;/ItemTemplate&gt;
                                        &lt;EditItemTemplate&gt;
                                            &lt;asp:TextBox ID="TextBox3" runat="server" Text='&lt;%# Bind("LabName") %&gt;'&gt;&lt;/asp:TextBox&gt;
                                        &lt;/EditItemTemplate&gt;
                                    &lt;/asp:TemplateField&gt;
                                    &lt;asp:TemplateField HeaderText="MachineName" SortExpression="MachineName"&gt;
                                        &lt;ItemTemplate&gt;
                                            &lt;asp:Label ID="Label4" runat="server" Text='&lt;%# Bind("MachineName") %&gt;'&gt;&lt;/asp:Label&gt;
                                        &lt;/ItemTemplate&gt;
                                        &lt;EditItemTemplate&gt;
                                            &lt;asp:TextBox ID="TextBox4" runat="server" Text='&lt;%# Bind("MachineName") %&gt;'&gt;&lt;/asp:TextBox&gt;
                                        &lt;/EditItemTemplate&gt;
                                    &lt;/asp:TemplateField&gt;
                                    &lt;asp:TemplateField HeaderText="MaxAllowedToResDay" 
                                        SortExpression="MaxAllowedToResDay"&gt;
                                        &lt;ItemTemplate&gt;
                                            &lt;asp:Label ID="Label5" runat="server" Text='&lt;%# Bind("MaxAllowedToResDay") %&gt;'&gt;&lt;/asp:Label&gt;
                                        &lt;/ItemTemplate&gt;
                                        &lt;EditItemTemplate&gt;
                                            &lt;asp:TextBox ID="TextBox5" runat="server" 
                                                Text='&lt;%# Bind("MaxAllowedToResDay") %&gt;'&gt;&lt;/asp:TextBox&gt;
                                        &lt;/EditItemTemplate&gt;
                                    &lt;/asp:TemplateField&gt;
                                &lt;/Columns&gt;
                                &lt;FooterStyle BackColor="#CCCC99" ForeColor="Black" /&gt;
                                &lt;PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" /&gt;
                                &lt;SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" /&gt;
                                &lt;HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" /&gt;
                            &lt;/asp:GridView&gt;
</code></pre>

<p>code behind:</p>

<pre><code>    protected void _gvPLCs_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType != DataControlRowType.DataRow)
        return;
    if (e.Row.Cells[2].Text == "&amp;nbsp;")
    {
        LinkButton lbnview = (LinkButton)e.Row.FindControl("lbnView");
        lbnview.Visible = false;
    }
}
</code></pre>

<p>this doesn't work with me..plz help</p>

<p>what i need is : when there is no a manual;the view manual link disappear</p>

<p>i tested it using this code :</p>

<pre><code>  if (e.Row.Cells[2].Text == string.Empty)
    {
        LinkButton lbnview = (LinkButton)e.Row.FindControl("lbnView");
        lbnview.Visible = false;
    }
</code></pre>

<p>but it always give me "" and always manaul field disappears</p>
