Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Hide Gridview(vb) Column using javascript

Posted on 2016-08-01
2
Medium Priority
?
230 Views
Last Modified: 2016-08-01
Could someone assist me with hiding a grid view column when the page load using java script.  I don't want to make the columns invisible as I need to read the data when the page loads.    Thanks



<asp:GridView ID="gvLiveLearners" runat="server" DataSourceID="dsLiveLeaners" AutoGenerateColumns="False" CssClass="tableAc" DataKeyNames="PROGRESS_RAG">
                        <Columns>
                            <asp:BoundField DataField="FULLNAME" HeaderText="FULLNAME" SortExpression="FULLNAME" />
                            <asp:BoundField DataField="SECTOR" HeaderText="Route" SortExpression="SECTOR" />
                            <asp:BoundField DataField="SCHEME" HeaderText="Level" SortExpression="SCHEME" />
                            <asp:BoundField DataField="LATEST_REVIEW" HeaderText="Last Review" ReadOnly="True" SortExpression="LATEST_REVIEW" DataFormatString="{0:d}" />
                            <asp:BoundField DataField="AptStartTime" HeaderText="Next Review" SortExpression="AptStartTime" DataFormatString="{0:d}" />
                            <asp:BoundField DataField="NextAptWith" HeaderText="NextAptWith" ReadOnly="True" SortExpression="NextAptWith" Visible="False" />
                            <asp:BoundField DataField="NUM_REVIEWS" HeaderText="Num Reviews" ReadOnly="True" SortExpression="NUM_REVIEWS" />
                            <asp:BoundField DataField="MonthOnPOT" HeaderText="MonthOnPOT" ReadOnly="True" SortExpression="MonthOnPOT" />
                            <asp:BoundField DataField="MonthsOnProgramme" HeaderText="Months on Program" ReadOnly="True" SortExpression="MonthsOnProgramme" />
                            <asp:BoundField DataField="EARLIEST_START_DATE" HeaderText="EARLIEST_START_DATE" ReadOnly="True" SortExpression="EARLIEST_START_DATE" DataFormatString="{0:d}" Visible="False" />
                            <asp:BoundField DataField="POTSTATUS" HeaderText="POTSTATUS" SortExpression="POTSTATUS" />
                            <asp:BoundField DataField="PROGRESS_RAG" HeaderText="PROGRESS_RAG" ReadOnly="True" SortExpression="PROGRESS_RAG" />
                            <asp:BoundField DataField="CURRENT_PDM" HeaderText="CURRENT_PDM" SortExpression="CURRENT_PDM" />
                            <asp:BoundField DataField="CONTRACT" HeaderText="CONTRACT" SortExpression="CONTRACT" Visible="False" />
                            <asp:BoundField DataField="TRAINEEID" HeaderText="TRAINEEID" ReadOnly="True" SortExpression="TRAINEEID" Visible="False" />
                            <asp:BoundField DataField="POT" HeaderText="POT" ReadOnly="True" SortExpression="POT" Visible="False" />
                            <asp:BoundField DataField="POTSTATUSID" HeaderText="POTSTATUSID" SortExpression="POTSTATUSID" Visible="False" />
                            <asp:TemplateField HeaderText="Discussed">
                                <EditItemTemplate>
                                    <asp:CheckBox ID="CheckBox1" runat="server" />
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:CheckBox ID="CheckBox1" runat="server" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <EmptyDataTemplate>
                            <asp:CheckBox ID="CheckBox1" runat="server" />
                        </EmptyDataTemplate>
                        <RowStyle BorderStyle="Dashed" BorderWidth="1px" HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:GridView>

Open in new window

0
Comment
Question by:Ed
[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
  • 2
2 Comments
 

Accepted Solution

by:
Ed earned 0 total points
ID: 41737375
Solved myself

Add this to the stylesheet

.hidden {
  display: none !important;
  visibility: hidden !important;
}

Open in new window



And set the css of the header at item in the gridview.

HeaderStyle-CssClass = "hidden" ItemStyle-CssClass="hidden"

Open in new window

0
 

Author Closing Comment

by:Ed
ID: 41737376
Solved with CSS
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

636 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