?
Solved

Hiding a control in a TemplateField in a GridView

Posted on 2011-09-29
3
Medium Priority
?
304 Views
Last Modified: 2012-08-14
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?
0
Comment
Question by:AIBMass
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Expert Comment

by:rar3z
ID: 36818810
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
0
 
LVL 12

Accepted Solution

by:
Ramkisan Jagtap earned 2000 total points
ID: 36819003
onrowdatabound event write code as below.
CheckBox chk=(CheckBox)e.Row.Findcontrol("chkPIP");
chk.Visible=False;
Or
chk.Enabled=false;
0
 

Author Closing Comment

by:AIBMass
ID: 36891282
Completely perfect. Thanks.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question