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

  • SEARCH
  • Home
  • 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 6009427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:58:08+00:00 2026-05-23T01:58:08+00:00

I have a problem to display a data from the database. I have 6

  • 0

I have a problem to display a data from the database. I have 6 columns(EmpName, EmpID, AdminCode, Practice, Hours, FTE) in my table and I want to display that data as below

blankArea       blankArea   blankarea        P1(PracticeName)    P2              P3
EmpName         EmpID      AdminCode     Hours   FTE        Hours   FTE     Hours    FTE

A 1 Insurance 0.14 0.03 0.00 0.00 0.00 0.00 A 1 AllDocs 0.19 0.04 0.00 0.00 0.00 0.00 B 2 Insurance 0.52 0.11 1.18 0.25 0.00 0.00 B 2 Payments 1.18 0.35 0.00 0.00 0.00 0.00 C 3 Payments 1.31 0.00 0.00 0.00 0.00 0.00

It means all details are in my table practice name is also in table and I use sql server 2005. How can I display my data as above format. Practice name is display horizontally and two columns are generated automatically and fill those columns with Hours and FTE column data which is exist in database.
Is repeater or datalist suitable for this. If yes then how. Have you any code regarding this. Please help.

Thanks in advance

  • 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-23T01:58:09+00:00Added an answer on May 23, 2026 at 1:58 am

    I would use a GridView and it’s RowCreated Event to generate the extra row in the header:

    ASPX:

    <asp:GridView ID="GridView1" runat="server" OnRowCreated="GridView1_RowCreated" ></asp:GridView>
    

    Codebehind(VB.Net):

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            'fake data
            Dim tbl As New DataTable
            tbl.Columns.Add(New DataColumn("EmpName", GetType(String)))
            tbl.Columns.Add(New DataColumn("EmpID", GetType(String)))
            tbl.Columns.Add(New DataColumn("AdminCode", GetType(String)))
            tbl.Columns.Add(New DataColumn("P1Hours", GetType(String)))
            tbl.Columns.Add(New DataColumn("P1FTE", GetType(String)))
            tbl.Columns.Add(New DataColumn("P2Hours", GetType(String)))
            tbl.Columns.Add(New DataColumn("P2FTE", GetType(String)))
            tbl.Columns.Add(New DataColumn("P3Hours", GetType(String)))
            tbl.Columns.Add(New DataColumn("P3FTE", GetType(String)))
            For i As Int32 = 1 To 100
                Dim newRow = tbl.NewRow
                newRow("EmpName") = "EmpName" & i
                newRow("EmpID") = "EmpID" & i
                newRow("AdminCode") = "AdminCode" & i
                newRow("P1Hours") = "P1Hours" & i
                newRow("P1FTE") = "P1FTE" & i
                newRow("P2Hours") = "P2Hours" & i
                newRow("P2FTE") = "P2FTE" & i
                newRow("P3Hours") = "P3Hours" & i
                newRow("P3FTE") = "P3FTE" & i
                tbl.Rows.Add(newRow)
            Next
            Me.GridView1.DataSource = tbl
            Me.GridView1.DataBind()
        End If
    End Sub
    
    Protected Sub GridView1_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
        If e.Row.RowType = DataControlRowType.Header Then
            'Build own custom header.
            Dim grid As GridView = DirectCast(sender, GridView)
            Dim newHeaderRow As New GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert)
            Dim oTableCell As New TableCell()
    
            'Add empty cell
            newHeaderRow.Cells.Add(oTableCell)
    
            'Add empty cell
            oTableCell = New TableCell()
            newHeaderRow.Cells.Add(oTableCell)
    
            'Add empty cell
            oTableCell = New TableCell()
            newHeaderRow.Cells.Add(oTableCell)
    
            'Add P1(PracticeName)-Cell
            oTableCell = New TableCell()
            oTableCell.Text = "P1(PracticeName)"
            oTableCell.ColumnSpan = 2
            oTableCell.Font.Bold = True
            oTableCell.HorizontalAlign = HorizontalAlign.Center
            newHeaderRow.Cells.Add(oTableCell)
    
            'Add P2-Cell
            oTableCell = New TableCell()
            oTableCell.Text = "P2"
            oTableCell.ColumnSpan = 2
            oTableCell.Font.Bold = True
            oTableCell.HorizontalAlign = HorizontalAlign.Center
            newHeaderRow.Cells.Add(oTableCell)
    
            'Add P3-Cell
            oTableCell = New TableCell()
            oTableCell.Text = "P3"
            oTableCell.ColumnSpan = 2
            oTableCell.Font.Bold = True
            oTableCell.HorizontalAlign = HorizontalAlign.Center
            newHeaderRow.Cells.Add(oTableCell)
            grid.Controls(0).Controls.AddAt(0, newHeaderRow)
        End If
    End Sub
    

    If you need C#, you can convert it here.

    This is the result:

    image of the resulting GridView

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have problem with load data from Database i use Primefaces (or other use
I want to fetch data from SQLITE database and display it in a LIST.
I have one problem regarding retriving data from database. I have created one database
I have a problem with retrieving data from a database using PHP statements. At
I'm having a little problem displaying data from a database... I have two database
i have a problem with VIMEO video . I want to display it in
I have this mysql tables I want to display with jqgrid. The problem appears
I am retrieving data from a SQL table so I can display the result
I try to retrieve HTML data from my database and display them in a
I have the following function that is pulling data from a database. The ajax

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.