Solved

removing headertext from a gridview

Posted on 2011-03-09
3
738 Views
Last Modified: 2013-11-07
I have a gridview I want the header to not show (th row)  

This is what I have coded.

  <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"
                DataSourceID="eventTeamHotelNames" >
                <Columns>
                             </asp:TemplateField>
                    <asp:TemplateField >
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("name") %>' CssClass="labelHotel2"></asp:Label>
                        </ItemTemplate>
                        <ControlStyle CssClass="labelHotel2" />
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>

This is what the browser shows.

<table cellspacing="0" rules="all" border="1" id="ctl00_ctl00_topbody_GridView2" style="border-collapse:collapse;">
            <tr>
                  <th scope="col">&nbsp;</th>
            </tr><tr>
                  <td>
                            <span id="ctl00_ctl00_topbody_GridView2_ctl02_Label1" class="label2" style="font-family:Arial,Helvetica;">Princeton</span>
                        </td>

            </tr>
      </table>
0
Comment
Question by:kw66722
3 Comments
 
LVL 10

Assisted Solution

by:hosneylk
hosneylk earned 200 total points
ID: 35090673
0
 
LVL 13

Accepted Solution

by:
agarwalrahul earned 300 total points
ID: 35090719
Code:

<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"
                DataSourceID="eventTeamHotelNames"  ShowHeader="false" > Add this
                <Columns>
                            </asp:TemplateField> Remove this
                    <asp:TemplateField >
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("name") %>' CssClass="labelHotel2"></asp:Label>
                        </ItemTemplate>
                        <ControlStyle CssClass="labelHotel2" />
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>

This is what the browser shows.

<table cellspacing="0" rules="all" border="1" id="ctl00_ctl00_topbody_GridView2" style="border-collapse:collapse;">
            <tr>
                  <th scope="col">&nbsp;</th>
            </tr><tr>
                  <td>
                            <span id="ctl00_ctl00_topbody_GridView2_ctl02_Label1" class="label2" style="font-family:Arial,Helvetica;">Princeton</span>
                        </td>

            </tr>
      </table>
0
 
LVL 1

Author Comment

by:kw66722
ID: 35091269
I am trying to close this accepting multiple solutions and when I click the multiple button it does not let me check of another one. It only takes the answer from the solution that I click accept multiple.  Any suggestions how I can do that?
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

911 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now