Click here to Skip to main content
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 19: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 OriginalGriff 270
1 Sergey Alexandrovich Kryukov 185
2 BillWoodruff 173
3 CPallini 155
4 Kamal Rocks 144
0 OriginalGriff 5,655
1 DamithSL 4,506
2 Maciej Los 3,997
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 7 Jul 2012
Copyright © CodeProject, 1999-2014
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