Hello,
Am trying to convert the content of a page to an Excel format, the problem is when I redirect the page I don't get my request variables so I found a solution that we should define a hiden variable for each request variable and then define the value after Get call. This is the code that am using now :
<script language="Javascript">
function exportToExcel()
{
document.frm.hndExcel.value = "true";
document.frm.submit();
}
</script>
<form name="frm" method="get" action="LibGetStatistics.asp" ID="Form1">
<% if Request.QueryString("hndExcel") = "true" then
Response.ContentType = "application/vnd.ms-excel"
end if%>
<%= GetStatistics() %>
<input type="hidden" name="hndExcel" value="false" ID="Hidden1">
*<input type="hidden" name="ShowOverDueBooks" value="
<%=Request.QueryString "ShowOverDueBooks")%>" ID="Hidden2">
<input type="hidden" name="StartDate" value="
<%=Request.QueryString("StartDate")%>" ID="Hidden3">
<input type="hidden" name="EndDate" value="
<%=Request.QueryString("EndDate")%>" ID="Hidden4">*
<a href="JavaScript:exportToExcel();"><img src='vimages/excel.gif' border=0></a>
</form>
The problem is when I want to use this code in other forms I need to declare a hidden variable for each Request variables. Is there any other way to generalize this code so when we post back the page we keep the same request.
Thanks.