GaryH
Posts: 5
|
| Posted: 03/07/2007, 9:47 AM |
|
I have a grid that contains the results from a search grid. The results grid resides on its own page and does not contain sorting nor a style. The data source is a sql table. I added the example custom code to output to excel. It exports the entire contents of the table. I see from the code, that it specifies the table and not the grid nor query results. I tried chaging the code to reference the grid/page to no avail. Can anyone offer a suggestion?
'Custom Code @68-73254650
' -------------------------
If(CCGetFromGet("export","") = "1") Then
'Show up to 10,000 records
tbl_xxx.PageSize = 10
'Hide the Navigator
tbl_xxx.Navigator.Visible = false
End if
' -------------------------
'End Custom Code
'Custom Code @67-73254650
' -------------------------
Dim ExportFileName
ExportFileName = "Report.xls"
If(CCGetFromGet("export","") = "1") Then
'Hide the ToExcelLink Link
ToExcelLink.Visible = False
Link.Visible = False
'Header.Visible = False
'Set Content type to Excel
Response.ContentType="application/vnd.ms-excel"
'Fix IE 5.0-5.5 bug with Content-Disposition=attachment
If InStr(Request.ServerVariables("HTTP_USER_AGENT"),"MSIE 5.5;") OR _
InStr(Request.ServerVariables("HTTP_USER_AGENT"),"MSIE 5.0;") Then
Response.AddHeader "Content-Disposition", "filename=" & ExportFileName & ";"
Else
Response.AddHeader "Content-Disposition", "attachment; filename=" & ExportFileName & ";"
End if
End if
' -------------------------
'End Custom Code
_________________
g |
 |
 |
DeanCovey
Posts: 22
|
| Posted: 03/08/2007, 4:10 AM |
|
I haven't done this in a long time. I created a page to output my data that had no styles or formatting to it. Then that page is
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
response.addHeader "Content-Disposition","inline; filename=Intellect_Export.xls"
Also go through the example pack 1. I think there's an example there.
|
 |
 |
GaryH
Posts: 5
|
| Posted: 03/08/2007, 6:38 AM |
|
Thanks for your response. I used the code/properties from the example. That example however, ouputs the entire contents of the data source (per the first section of custom code). my question is how to output just the query results that are contained in the grid, from a search page query. How can I refence the grid's contents? I'm pretty much a novice when it comes to writing native asp/scripts custom code.
_________________
g |
 |
 |
bedollandres
Posts: 48
|
| Posted: 03/08/2007, 7:28 AM |
|
you need to add the url parameters of the search results in the WHERE of the sql of the grid...
_________________
bedollandres |
 |
 |
bedollandres
Posts: 48
|
| Posted: 03/08/2007, 7:28 AM |
|
you need to add the url parameters of the search results in the WHERE of the sql of the grid...
_________________
bedollandres |
 |
 |
teke507
Posts: 69
|
| Posted: 05/09/2007, 6:59 AM |
|
Im having the same problem and the search parameter are in the where clause of the grid the problem is when you export to excel it doesnt care what the where parameters of the grid are.....it looks like when you export to excel tyhe url parameters from the search are gone...it turn the url like this
Before
mypage.php?field=1223?field2=3212?field3=jhsha
So on and so forth but when you press the export to excel the url looks like this
After
mypage.php?export=1
The search parameters are missing im sure that has something to do with it but i do not know how to fix it....if you find the anwser please post for i am in need of the same functionality/
|
 |
 |
teke507
Posts: 69
|
| Posted: 05/09/2007, 7:09 AM |
|
I just figured it out...in your link properties perserve parameters select Get an Post and that should work...im still having a problem that my search table shows up in my excel you wouldnt happen to know how to get rid of that?
|
 |
 |
MAGS
Posts: 1
|
| Posted: 05/23/2007, 10:30 AM |
|
Thanks the Get an Post worked well. As far as the search grid, I just used a separate search page and pointed the results to the grid page.
|
 |
 |