jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Server side Export to Excel › Reply To: Server side Export to Excel
I found an way to accomplish the same thing using ASP Classic and VBScript:
Code for export.asp
<!--#include virtual="connection_string.asp"-->
<%
Response.ContentType = "application/vnd.ms-excel"
Response.addHeader "content-disposition", "attachment; filename=FooBar.xls"
strWHERE = Request.QueryString("queryString")
strSQL = "SELECT * FROM fooGrid " & strWHERE
Set rs = conn.Execute(strSQL)
%>
<HTML>
<BODY>
<TABLE BORDER=1 BORDERCOLOR="#CCCCCC">
<TR>
<% For each fField in rs.Fields %>
<TD style="background-color:black; color: white;"><%=fField.Name%></TD>
<% Next %>
</TR>
<% do while not rs.eof %>
<TR>
<% For i = 0 to 9 ' Assume there are 10 columns in the table %>
<TD><%=rs(i)%></TD>
<% Next %>
</TR>
<% rs.movenext
loop %>
</TABLE>
</BODY>
</HTML>