Click here to Skip to main content
15,917,473 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
GridView1.DataSource = ds.Tables[1].Rows[0];
Posted
Comments
CHill60 14-Jul-14 8:23am    
That is indeed how to get the first row of the second table in the dataset ds. What is your actual problem?
I would have expected to see GridView1.DataSource = ds.Tables[1]; so that the datatable is the datasource, not just a single row

C#
GridView1.Rows.Add();
GridView1.Rows[0]= ds.Tables[1].Rows[0];
 
Share this answer
 
clone that table and import that row in new table and bind that table to grid and shown below.


C#
DataTable dtBind = ds.Tables[1].Clone();

           dtBind.ImportRow(ds.Tables[1].Rows[0]);

           GridView1.DataSource = dtBind;
           GridView1.DataBind();
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900