Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6618345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:49:15+00:00 2026-05-25T20:49:15+00:00

I have a gridview. Is it possible to modify the gridview so that I

  • 0

I have a gridview. Is it possible to modify the gridview so that I can have multiple rows in the column headers? For example, the following code generates the table in the picture below.

<asp:GridView ID="productsGridView" Runat="server" DataSourceID="productDataSource" AutoGenerateColumns="False" AllowSorting="True" BorderWidth="2px" 
            BackColor="White" GridLines="None" CellPadding="3" CellSpacing="1" BorderStyle="Ridge" BorderColor="White" AllowPaging="True">
    <FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
    <PagerStyle ForeColor="Black" HorizontalAlign="Right" BackColor="#C6C3C6"></PagerStyle>
    <HeaderStyle ForeColor="#E7E7FF" Font-Bold="True" BackColor="#4A3C8C"></HeaderStyle>

    <Columns>
       <asp:BoundField HeaderText="Product" DataField="ProductName" SortExpression="ProductName"></asp:BoundField>
       <asp:BoundField HeaderText="Unit Price" DataField="UnitPrice" SortExpression="UnitPrice" DataFormatString="{0:c}">
          <ItemStyle HorizontalAlign="Right"></ItemStyle>
       </asp:BoundField>
       <asp:BoundField HeaderText="Units In Stock" DataField="UnitsInStock" SortExpression="UnitsInStock" DataFormatString="{0:d}">
          <ItemStyle HorizontalAlign="Right"></ItemStyle>
       </asp:BoundField>
       <asp:BoundField HeaderText="Quantity Per Unit" DataField="QuantityPerUnit"></asp:BoundField>
    </Columns>
    <SelectedRowStyle ForeColor="White" Font-Bold="True" BackColor="#9471DE"></SelectedRowStyle>
    <RowStyle ForeColor="Black" BackColor="#DEDFDE"></RowStyle>
</asp:GridView>

enter image description here

This table only has one row in the column header. What I am looking for is something like this:

enter image description here

Any Ideas on how I can achieve this? Is this even possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:49:16+00:00Added an answer on May 25, 2026 at 8:49 pm

    If you use a TemplateField instead, you can control the header template as well, which can be custom ASPX markup. The downside is that you have to display the data manually with Labels instead of using the simpler BoundField properties. However, this also allows you to layout the data in a custom layout to fit with the heading:

    <Columns>
        <asp:TemplateField>
            <HeaderTemplate>
                Weight<br />
                Date | Time<br />
                Product
            </HeaderTemplate>
            <ItemTemplate>
                <asp:Label runat="server" Text='<%#Eval("Weight") %>'></asp:Label><br />
                <asp:Label runat="server" Text='<%#Eval("Date") %>'></asp:Label> |
                <asp:Label runat="server" Text='<%#Eval("Time") %>'></asp:Label><br />
                <asp:Label runat="server" Text='<%#Eval("Product") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview control that can get loaded with multiple pages worth of
I have a gridview with rows that can be edited, inserted etc. I wrapped
I have a gridview where I can select multiple rows by pressing a control
I have a GridView that allows editing the values in every column, in every
I have a gridview that I wish to display gridlines only on certain rows.
I have one GridView with 3 Column and 3 Rows I want to change
How can you specify a column span in an android's gridview? I have a
is possible to have a separator between elements of a GridView? Thanks
I have GridView which I can select a row. I then have a button
Have a gridview control which will show X amount of rows. I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.