To show custom fields in the xlResults.aspx page:
First, you have to make some mods to the xlSearchResults.aspx.vb file to display custom fields and then add these fields to xlResults.aspx in order to display them.
1. In xlResults.aspx.vb at or around line 56, we need to specify the csv columns to bring them into the results. To to this:
REPLACE
Public ReadOnly Property csv_columns() As String
Get
If Not IsNothing(Request.Params("csv_columns")) Then
Return "csv_columns=" &
Request.Params("csv_columns").ToString
Else
Return ""
End If
End Get
End Property
WITH
Public ReadOnly Property csv_columns() As String
Get
Return "&csv_columns=distance,name,street,city,state,zip,country,phone,custom field1,"
End Get
End Property
Note: You must list all fieldnames you require on the same line. The above sample code is limited in order to display on a single line as required.
2. In xlResults.aspx.vb, at or around Line 140:
REPLACE
If _strURL.ToLower.IndexOf("format") = -1 Then _strURL += "&" & Me.format()
WITH
If _strURL.ToLower.IndexOf("format") = -1 Then _strURL += "&" & Me.format() & Me.csv_columns()
3. Now, in xlResults.aspx, we must add the code to display the new fields. To do this, add the following where you want the field contents to display:
<%#Container.DataItem(XX)%>
Note: Replace XX with a 2 digit number corresponding to the field DataItem number. Default fields number 0-19 so custom fields begin at 20. The first custom field you create will be number 20 and so on.
Article is in the following categories:
KB » Asp.NET Customization Tips
KB » Asp.NET Customization Tips

How to show Custom Fields in xlResults.aspx
Email This Article