Click here to Skip to main content
15,896,501 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Team,

How to hide particular column in grid view control?

I want to hide particular columns,
At the same time nested Gridview columns also need to be hide.

Thanks in Advance.
Posted
Comments
george4986 3-Mar-14 6:03am    
are u using windows or web form

if your column is autogenearted then use
C#
Gridview1.column[index].visible=false;

Otherwise set visible false on aspx page 
 <asp:gridview id="Grid_Show" runat="server" >                       
   <columns>
    <asp:templatefield visible="false">
    <itemtemplate>
        <asp:label id="lblID" runat="server" text="<%#Bind("ID")%>"></asp:label>                                
       </itemtemplate>
     </asp:templatefield>
 </columns>
</asp:gridview>
 
Share this answer
 
v3
 
Share this answer
 
v2
 
Share this answer
 
gv.column[colIndex].Visible=false;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900