Link to home
Start Free TrialLog in
Avatar of AIBMass
AIBMass

asked on

Hiding a control in a TemplateField in a GridView

I have the following Template field in a GridView:

               <asp:TemplateField HeaderText="PIP">
                <ItemTemplate>
                <asp:Label runat="server" Text='<%#Eval("PIP") %>'></asp:Label>
                <asp:CheckBox ID="chkPIP" runat="server" />
                </ItemTemplate>
                </asp:TemplateField>

On some rows, I do not want the CheckBox to be visible or at least not checkable.

I am trying to use the RowDataBound event, but I can't figure out how to reference my checkbox control.

Can anyone show me how?
Avatar of rar3z
rar3z
Flag of United States of America image

I needed to some something similar to that, I remember I had to build the GridView using code behind only then you would be able to reference it and it would be dynamic.

I think the link I followed was this.

Building a referencable dynamic gridview
ASKER CERTIFIED SOLUTION
Avatar of Ramkisan Jagtap
Ramkisan Jagtap
Flag of Finland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AIBMass
AIBMass

ASKER

Completely perfect. Thanks.