Solved

removing headertext from a gridview

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
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 …

752 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