Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

removing headertext from a gridview

Posted on 2011-03-09
3
Medium Priority
?
782 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
[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 10

Assisted Solution

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

Accepted Solution

by:
Rahul Agarwal earned 1200 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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

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

MS Access 2003 or later To MySQL Migration Project Hello All, this is my second article in the category of MS-OFFICE Automation. In internet I am not able to find any comprehensive resource on the Migration of MS Access back-end to MySQL so I fin…
Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
Viewers will learn the different options available in the Backstage view in Excel 2013.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

688 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