Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET
How to store Gridview data into Datatable
my code is:
DataTable dtt=new DataTable();
Posted 11-Feb-13 18:20pm
Edited 11-Feb-13 18:30pm
vinodkumarnie at 12-Feb-13 1:20am
Are you binding gridview using Sqldatasource..?
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

Data Source type of GridView and DataTable is different. You need to convert it like this.
BindingSource source = (BindingSource)gridView1.DataSource;
DataTable dt = (DataTable)source.DataSource;
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

its very simple i will show u a sample method u just tweak it according to your needs
string str = "select pcode,fyyear,date,salary,ta,contigency,nrc,institcharges,others from monthly";
        SqlDataAdapter adp = new SqlDataAdapter(str, con);
        DataTable dt = new DataTable();
        GridView1.DataSource = dt;
Sheikh Muhammad Haris at 14-Feb-13 21:39pm
He didn't want to bind GridView data. He asks for getting gridview data in a data table

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 566
1 OriginalGriff 345
2 CPallini 200
3 PIEBALDconsult 150
4 Magic Wonder 131
0 OriginalGriff 5,795
1 Sergey Alexandrovich Kryukov 5,028
2 CPallini 4,700
3 George Jonsson 3,142
4 Gihan Liyanage 2,450

Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 14 Feb 2013
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