copy data from datagrid into datatable

Posted by Alok under ASP.NET on 1/27/2012 | Points: 10 | Views : 2454 | Status : [Member] | Replies : 3
How Can I Import All Data from Datagrid into Datatable..

Thanks & Regards,
Alokssm



Responses

Posted by: Blessyjees on: 1/27/2012 [Member] Bronze | Points: 25

Up
0
Down
hi,
how do you bind your grid. do you need to insert whole grid data to data table?

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Alok, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Alok on: 1/27/2012 [Member] Starter | Points: 25

Up
0
Down

datagrid1.datasource=query;
datagrid1.databind();

this 'query' is result of Linq to xml

ex: var query=from c in db.context
select new { emp_id =c.id,emp_name=c.name }
now i have a table as
datatable dt=new datatable();
in this
'dt ' i want to transfer all data from datagrid




Thanks & Regards,
Alokssm

Alok, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Blessyjees on: 1/27/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Can you try like this dt = (DataTable)query;

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Alok, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response