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 6172021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:19:17+00:00 2026-05-23T23:19:17+00:00

i got a problem with grid view ,because I’m new to asp.net(10 days),so i

  • 0

i got a problem with grid view ,because I’m new to asp.net(10 days),so i donno how to do it,so can you guyz please help me out this problem..

i have a simple gridview ,and i have to make new grid with row value as column header name

Empname Earnngs Amount

Austin HRA 20,000$

Austin DA 1,000$

Austin Basic 5,000$

and i have to make like this

.Austin HRA DA BASIC

    2000$ 2000$ 2000$

Please give some idea and some examples using C# to do it

  • 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-23T23:19:17+00:00Added an answer on May 23, 2026 at 11:19 pm

    Here is an example of doing this using an asp GridView:

    // Create new DataTable.
    DataTable dt = new DataTable();
    
    // Total count of columns.
    int colCount = 3;
    
    // Add 3 columns.
    for (int i = 0; i < colCount; i++)
    {
        dt.Columns.Add(new DataColumn("col" + i.ToString()));
    }
    
    // Add data to the datatable.
    dt.Rows.Add(new object[] { "Empname", "Earnngs", "Amount" });
    dt.Rows.Add(new object[] { "Austin", "Earnngs", "Amount" });
    dt.Rows.Add(new object[] { "Austin", "df", "Amount" });
    dt.Rows.Add(new object[] { "sdfsdf", "dsfdf", "df" });
    dt.Rows.Add(new object[] { "Empdsfsdfname", "Earnngs", "df" });
    
    // Loop through each column in the DataTable and set the column name to the data in the first row of data.
    foreach (DataColumn dc in dt.Columns)
    {
        dc.ColumnName = dt.Rows[0][dc].ToString();
    }
    
    // Set the datasource of the grid.
    this.GridView1.DataSource = dt;
    
    // Bind the data to the grid.
    this.GridView1.DataBind();
    

    See these:

    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview(v=VS.100).aspx

    http://msdn.microsoft.com/en-us/library/system.data.datatable.aspx

    http://msdn.microsoft.com/en-us/library/system.data.datacolumn.aspx

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

Sidebar

Related Questions

I have got a problem with GridView because I do not understand how can
Got a problem with ADOMD.NET 8.0, SQL2008 and our app. It isn't giving us
Ive got a problem - in my grid I linked two combobox (country and
I've got the following problem: in our teams software you can navigate to a
I've got a view with a few simple fields and a jQuery grid. The
I've got a problem with the RadDataPager from Telerik... I can show all my
I've got an web app in ASP.NET 2.0 in which I need to do
I've got a ASP.NET 3.5 sp1 site, and on one page I have two
I've got a GridView that can be edited. My problem is that when I
i got problem with my code and hopefully someone able to figure it out.

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.