-
Feb 23rd, 2011, 07:01 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] gridview to dataset
Hi,
how to get datatable from gridview???
somthing like this:
DataTable dt = gridview1.DataSource as DataTable;
-------------
I don't want to save data in session before grid binding.
-------------
Sagar
VB6, VB.net,C#,ASP, ASP.net MSSQL, MYSQL
-
Feb 24th, 2011, 02:31 AM
#2
Re: gridview to dataset
Hello,
The short answer is that you can't get it back directly, I don't think. You would need to re-generate the DataTable by looping through the rows of the GridView. Something like this:
Code:
foreach (GridViewRow row in this.GridView1.Rows)
{
DataRow dr = dt.NewRow();
dr["User Name"] = row.Cells[1].Text;
dr["User Email"] = row.Cells[2].Text;
dt.Rows.Add(dr);
}
Not pretty.
If there is another way, I would be interested to know what that is.
Gary
-
Feb 24th, 2011, 04:23 AM
#3
Thread Starter
Hyperactive Member
Re: gridview to dataset
I know this.... bt not confirm thats why i post this thread.....
I am searching for that another way.... i will keep open this thread for 2 or 3 days more if any1 can know much more about this...
But now I am sure it is not possible.
If this is thing possible then we can really use disconnected database. I dont want to save dataset in session caz it will create memory issues. Do u agree??
Sagar
VB6, VB.net,C#,ASP, ASP.net MSSQL, MYSQL
-
Feb 25th, 2011, 02:22 AM
#4
Re: gridview to dataset
Depending on the size of the DataTable/DataSet that you are using, then yes, it can lead to memory issues. In this type of situation, you need to look at the actual data that you are pulling back to decide whether you actually need all of that data or not.
What is the actual requirement to retrieve the DataTable again? What information are you trying to get at?
Gary
-
Feb 28th, 2011, 11:15 PM
#5
Thread Starter
Hyperactive Member
Re: gridview to dataset
thanks Gary, now I hv thinked lot and I have changed the flow of project n this is quite good and client is very happy for that n concern abt gridview to dataset is not possible or we dnt knw.
Sagar
VB6, VB.net,C#,ASP, ASP.net MSSQL, MYSQL
-
Mar 1st, 2011, 01:55 AM
#6
Re: [RESOLVED] gridview to dataset
Glad to hear it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|