Solved

removing headertext from a gridview

Posted on 2011-03-09
3
753 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 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
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 …

735 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