I have a repeater which displays the result of a recordset and a function which determins whether to display web or email link. It works but the function is not being repeated properly, the first record is being repeated for all results.....any help would be appreciated on how to overcome this....


I have the following function at the top of my page:
<%
strEmail = GetListings.Fields.Item("Email").Value
strWWW = GetListings.Fields.Item("WWW").Value
%>
<%
Function GetContactDetails( _
ByVal strEmail, _
ByVal strWWW _
)

If isNull(strWWW) then
If not isNull(strEmail) then
GetContactDetails = "<a href=""mailto:" & strEmail & "?subject=" & "Enquiry"">Email Us</a>"
Else
GetContactDetails = ""
End If
Else
If not isNull(strWWW) then
GetContactDetails = "<a href=""http://" & strWWW & """ target=" & "_blank"">Visit Us</a>"
End If
End If
End Function
%>

and then in the html I have a repeater:

<%
While ((Repeat1__numRows <> 0) AND (NOT GetListings.EOF))
%>
<tr>
<td valign="top"><strong><%=(GetListings.Fields.Item("BusinessName").Value)%></strong><br />
<%=(GetListings.Fields.Item("Address1").Value)%><%=(GetListings.Fields.Item("Address2").Value)%><br /> <%=(GetListings.Fields.Item("SubPost").Value)%><br /> </td>
<td valign="top"><%=(GetListings.Fields.Item("Phone").Value)%></td>
<td valign="top"><%=(GetListings.Fields.Item("Fax").Value)%></td>
<td valign="top"><%=GetContactDetails(strEmail, strWWW)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
GetListings.MoveNext()
Wend
%>

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...

Re: function not repeating.... by Randy

Randy
Fri Jul 11 07:41:26 CDT 2003

I think your problem is that you need to reset the values of strEmail and
strWWW before sending them to the function. It looks like you're setting
them outside the While Wend loop, so they're just keeping the values of the
first record. You need to put them inside the loop, so they pick up the
values of each record.


"John Pether" <john@<nospam>dotnetsites.net> wrote in message
news:Oxc6Fj3RDHA.3144@tk2msftngp13.phx.gbl...
> I have a repeater which displays the result of a recordset and a function
which determins whether to display web or email link. It works but the
function is not being repeated properly, the first record is being repeated
for all results.....any help would be appreciated on how to overcome
this....
>
>
> I have the following function at the top of my page:
> <%
> strEmail = GetListings.Fields.Item("Email").Value
> strWWW = GetListings.Fields.Item("WWW").Value
> %>
> <%
> Function GetContactDetails( _
> ByVal strEmail, _
> ByVal strWWW _
> )
>
> If isNull(strWWW) then
> If not isNull(strEmail) then
> GetContactDetails = "<a href=""mailto:" & strEmail & "?subject=" &
"Enquiry"">Email Us</a>"
> Else
> GetContactDetails = ""
> End If
> Else
> If not isNull(strWWW) then
> GetContactDetails = "<a href=""http://" & strWWW & """ target=" &
"_blank"">Visit Us</a>"
> End If
> End If
> End Function
> %>
>
> and then in the html I have a repeater:
>
> <%
> While ((Repeat1__numRows <> 0) AND (NOT GetListings.EOF))
> %>
> <tr>
> <td
valign="top"><strong><%=(GetListings.Fields.Item("BusinessName").Value)%></s
trong><br />
>
<%=(GetListings.Fields.Item("Address1").Value)%><%=(GetListings.Fields.Item(
"Address2").Value)%><br />
<%=(GetListings.Fields.Item("SubPost").Value)%><br /> </td>
> <td
valign="top"><%=(GetListings.Fields.Item("Phone").Value)%></td>
> <td valign="top"><%=(GetListings.Fields.Item("Fax").Value)%></td>
> <td valign="top"><%=GetContactDetails(strEmail, strWWW)%></td>
> </tr>
> <%
> Repeat1__index=Repeat1__index+1
> Repeat1__numRows=Repeat1__numRows-1
> GetListings.MoveNext()
> Wend
> %>
>
> **********************************************************************
> Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
> Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...