|
I tried using oledbconnection with excel and exported data into it but it doesn't support on 64bit.
In 32bit it works well.
But in 64bit it works partially.
Can you give me any solution...
|
|
|
|
|
Redirect/open window to pageListForExportExcel.aspx in page1.aspx
so in page1 set input button to redirect/open window to pageListForExportExcel.aspx
in page1 :
<input type="button" value="Export to Excel" onclick="ExportToExcel()"/>
and you need javascript or JQuery for create function redirect/open window to pageListForExportExcel.aspx
<script type="text/javascript">
function ExportToExcel()
{
var txt = window.open("pageListForExportExcel.aspx");
}
</script>
in ASPX (pageListForExportExcel.aspx), use repeater for display you data from datatable,Example set to be this :
<%@ Page Language="C#" AutoEventWireup="true" EnableSessionState="ReadOnly" EnableViewState="false" CodeBehind="BukuInduk_exportToExcel.aspx.cs" Inherits="LimSys.Web.Laporan.BukuInduk_exportToExcel" %>
<asp:Repeater ID="rep1" runat="server">
<HeaderTemplate>
<table border=1>
<tr>
<td>NAME</td>
<td>ADDRESS</td>
<td>TELP</td>
<td>GENDER</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# Eval("name")%></td>
<td><%# Eval("address")%></td>
<td><%# Eval("telp")%></td>
<td><%# Eval("gender")%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
and the last,in code behind pageListForExportExcel.aspx.cs
use this :
protected void Page_Load(object sender, EventArgs e)
{
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.ms-excel";
var process = new DataLayersCollections();
var list = process.GetListFromDataTable();
rep1.DataSource = list;
rep1.DataBind();
}
and the latter again .......
good luck ....
hope this help you.....
|
|
|
|