Click here to Skip to main content
11,719,753 members (88,547 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
I have many DataTables in DataSet... I want to bind all the rows of DataTables from DataSet to gridview... Any idea for this... Thanks!!!
Posted 5-Jul-12 18:16pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

So you are saying that you want all the datatables' data into a single gridview.

Well for that

1. ensure that all the tables in the datatable have same schema, else its little troublesome and complicated.
2. have a temporary datatable and push all the datatables data into that.
3. bind the gridview with this temp datatable.
  Permalink  
Comments
zinnwe88 at 6-Jul-12 3:30am
   
thx for yr ans...:)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

hello

you can simply bind dataTable those you need like:-
gridView1.DataSource=datasetObj.Tables["rizwanTableName if it not work then use index "];
gridview1.Databind();
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

hello

you can simply bind dataTable those you need like:-
gridView1.DataSource=datasetObj.Tables["rizwanTableName if it not work then use index "];
gridview1.Databind();
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

DataSet Datasetname = SqlHelper.ExecuteDataset(ConfigurationManager.AppSettings["MyConnectionString"],
"YourProcname",
Parameters);
// For First table
if (Datasetname .Tables[0].Rows.Count > 0)
{
gridview.DataSource = Datasetname ;
gridview.DataBind();

}
// For Second table
if (Datasetname .Tables[1].Rows.Count > 0)
{
gridview.DataSource = Datasetname ;
gridview.DataBind();

}
Column and column name should be same for all Tables
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 1,734
1 OriginalGriff 690
2 Maciej Los 569
3 Richard MacCutchan 540
4 F-ES Sitecore 510


Advertise | Privacy | Mobile
Web02 | 2.8.150901.1 | Last Updated 7 Jul 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100