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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:55:29+00:00 2026-05-24T03:55:29+00:00

Simple enough. Cant find a simple solution. Not sure if their is a simple

  • 0

Simple enough. Cant find a simple solution. Not sure if their is a simple solution? :/

I have a dataTable. I essentially want to achieve this…

DataTable dt = new DataTable();
dataAdapter.Fill(dt);

TableRow tr = new TableRow();
tr = dt.Rows[0];

but i cant convert from DataRow to a TableRow!

Help!

Alex

  • 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-24T03:55:30+00:00Added an answer on May 24, 2026 at 3:55 am

    if your goal is to show on the UI the data that are within a dataTable(or any other datasource) why don’t you use a repeater?

    anyway you can’t just convert the DataTableRow to TableRow but you have to do it yourself.
    have a look at the below code

    private void GenerateTable()
    
        {
    
            DataTable dt = CreateDataTable();
    
            Table table = new Table();
    
            TableRow row = null;
    
    
    
            //Add the Headers
    
            row = new TableRow();
    
            for (int j = 0; j < dt.Columns.Count; j++)
    
            {
    
                TableHeaderCell headerCell = new TableHeaderCell();
    
                headerCell.Text = dt.Columns[j].ColumnName;
    
                row.Cells.Add(headerCell);
    
            }
    
            table.Rows.Add(row);
    
    
    
            //Add the Column values
    
            for (int i = 0; i < dt.Rows.Count; i++)
    
            {
    
                row = new TableRow();
    
                for (int j = 0; j < dt.Columns.Count; j++)
    
                {
    
                    TableCell cell = new TableCell();
    
                    cell.Text = dt.Rows[i][j].ToString();
    
                    row.Cells.Add(cell);
    
                }
    
                // Add the TableRow to the Table
    
                table.Rows.Add(row);
    
            }
    
            // Add the the Table in the Form
    
            form1.Controls.Add(table);
    
        }
    

    source:

    http://geekswithblogs.net/dotNETvinz/archive/2009/06/24/fill-asp.net-table-with-data-from-datatable.aspx

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

Sidebar

Related Questions

Simple enough question, but I cant find ant half-decent documentation on it. Right so
This sounds like a simple enough question, but can't find the answer for the
I know there is a simple solution to this but can't seem to find
Guys, Well I have done enough research still I can't find the solution to
I though this would be simple enough but I can't find the answer. I
This seems simple enough, but I can't seem to find the setting in Eclipse
Well, it seems simple enough, but I can't find a way to add a
Seems like a simple enough question but I can't seem to find the answer.
This should seem simple enough, but can't figure it out. I was porting a
Simple enough question: I'm using python random module to generate random integers. I want

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.