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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:39:17+00:00 2026-06-14T15:39:17+00:00

I have multiple datatable. I want to show all the datatable rows into a

  • 0

I have multiple datatable. I want to show all the datatable rows into a single gridview.
How can I do that?

DataTable dtbag101 = (DataTable)Session["bag101"];
DataTable dtwallet111 = (DataTable)Session["wallet111"];


DataSet ds= new DataSet();
ds.Tables.Add(dtbag101);
ds.Tables.Add(dtwallet111);

GridView1.DataSource= ds;
GridView1.DataBind();

The column names for both datatable are the same.
Here I was trying to use dataset but only first DataTable i.e. datbag101 was showing in the gridview.

How can I show all the values in one gridview?

  • 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-14T15:39:18+00:00Added an answer on June 14, 2026 at 3:39 pm

    You may need to use DataTable.Merge

    DataTable dtAll = new DataTable();
    dtAll = dtbag101 .Copy();
    dtAll.Merge(dtwallet111, true);
    GridView1.DataSource= dtAll;
    GridView1.DataBind();
    

    Edit to show how it should work

    private void BindGridWithMergeTables()
    {
        DataTable dt1 = new DataTable();
        DataTable dt2 = new DataTable();
    
        dt1.Columns.Add("ID");
        dt2.Columns.Add("ID");
    
        DataRow dr1 = dt1.NewRow();
        DataRow dr2 = dt2.NewRow();
    
        dr1["ID"] = "1";
        dr2["ID"] = "2";
        dt1.Rows.Add(dr1);
        dt2.Rows.Add(dr2);
    
        DataTable dtAll = new DataTable();
        dtAll = dt1.Copy();
        dtAll.Merge(dt2, true);
        dataGridView1.DataSource = dtAll;
        dataGridView1.DataBind();
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a datatable that contains rows of transaction data for multiple users. Each
Well. I have a DataTable with multiple columns and multiple rows. I want to
I have multiple domains on my server. I want to redirect all of them
I have multiple excel files which I open as datatable I want to merge
I have a method to process the rows from a datatable using multiple threads,
I have problems to export selected listboxitems to a datatable,I want to have multiple
I have multiple UpdatePanels on a webpage, one inside UserControl (Purple ColorBox as show
I have multiple forms for lots of products on my page and want to
I have multiple websites run on single database. My question related table Structure is
I have a rich:datatable which may be reRendered my multiple components in my page.

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.