G
Guest
Hi,
I have to export data inside the datagrid into an excel worksheet. I have
to do this on button click event. I am trying to do like this.
First get the DataTable from the datagrid and iterate through each row to
get the data. I am not able to get the DataTable from the datagrid. How could
I do that? I tried like this but it is not working
Dim dt as DataTable = CType(datagrid1.DataSource, DataTable)
I have also tried this
Dim t as Table = datagrid1.Controls(0). This one is giving the data in the
form of a table. but the problem is, If I have a datagrid that contains
LinkButtons and If I need to get the text of that LinkButtons, it is not
getting them. Is there a way to get the full data even the text on the
controls so that I could export it to excel?
Thnx!
I have to export data inside the datagrid into an excel worksheet. I have
to do this on button click event. I am trying to do like this.
First get the DataTable from the datagrid and iterate through each row to
get the data. I am not able to get the DataTable from the datagrid. How could
I do that? I tried like this but it is not working
Dim dt as DataTable = CType(datagrid1.DataSource, DataTable)
I have also tried this
Dim t as Table = datagrid1.Controls(0). This one is giving the data in the
form of a table. but the problem is, If I have a datagrid that contains
LinkButtons and If I need to get the text of that LinkButtons, it is not
getting them. Is there a way to get the full data even the text on the
controls so that I could export it to excel?
Thnx!