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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:36:40+00:00 2026-06-18T02:36:40+00:00

I need to make a comparison table in HTML format, the problem is that

  • 0

I need to make a comparison table in HTML format, the problem is that the items
in database comes as a columns but in comparison table it must be a rows!

Example

The data in database looks like the following

 ID  Name     Color   Weight
-------------------------------
 1   Ball     Red     10
 2   Table    Black   50
 3   Chair    Green   30

And it must looks like the following in comparison table

ID      1         2        3
Name    Ball      Table    Chair
Color   Red       Black    Green
Weight  10        50       30

I am using ASP.NET with repeater but it didn’t work,
Can you please help me to find the best way to do this.

I must use something like repeater because the numbers of columns in the the comparison table varies.

  • 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-06-18T02:36:41+00:00Added an answer on June 18, 2026 at 2:36 am

    A possible solution:

    Given the following DataTable as datasource:

    protected DataTable Data
    {
        get
        {
            if (ViewState["Data"] == null)
            { 
                DataTable table = new DataTable();
                table.Columns.Add("ID", typeof(int));
                table.Columns.Add("Name");
                table.Columns.Add("Color");
                table.Columns.Add("Weight", typeof(int));
    
                table.Rows.Add(1, "Ball", "Red", 10);
                table.Rows.Add(2, "Table", "Black", 50);
                table.Rows.Add(3, "Chair", "Green", 30);
                ViewState["Data"] = table;
            }
            return (DataTable)ViewState["Data"];
        }
    }
    

    And some ASP code for looping and building the table:

    <table>
    <%
      for (int i = 0; i < Data.Columns.Count; i++)
      {
            %>
            <tr>
                <td><%= Data.Columns[i].ColumnName %></td>
                <%
                    for (int j = 0; j < Data.Rows.Count; j++)
                    {
                        %>
                        <td><%= Data.Rows[j][i] %></td>
                        <%
                    }
    
                 %>
            </tr>
            <%  
      } 
    %>
    </table>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some records that I need to store in a database table and
I need to make the top header of a report disappear. The part that
Possible Duplicate: MySQL date format i have this date which i need to make
I'm writing a SQL script to remove some rows from my table. I need
I have a table that holds price information. I need to select the max
I have a to compare dates in 2 tables but the problem is that
I need to make this comparison: if (x < siteA.style.left || x > siteA.style.left
I have a database of tables that I needed to do some comparison work
I have a strange problem to update a table in my database...forgive me if
I need make some action (dump statistical data) before the Dart program ends. The

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.