473,324 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

function not repeating....

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").Va lue)%></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...
Jul 19 '05 #1
1 1889
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:Ox**************@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").Va lue)%></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...
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Joe | last post by:
I have 3 functions: ClientInfoA is doing something ClientInfoB is doing something SelectFunction2Run is a function to determine which function needed to run based on the value of the variable...
5
by: Tom Lam lemontea | last post by:
Hi all, This is my very first post here, I've seriously tried some programming on C, and shown below is my very first program(So you can expect it to be very messy) that I wrote after I've learned...
0
by: dino07 | last post by:
Hi All, I am currently trying to do the following: 1. insert a value into a repeating table from a drop-down list( secondary storage) when the user click the "Add" button positioned next to the...
11
by: Christoph Boget | last post by:
When building a form using Infopath, you can define a repeating section and stick form fields in that section. I'm curious if ASP.NET has a similar control to make it easy to design something...
7
by: TC | last post by:
Visual Basic used to have a function called String(), which would create a repeating character string. Is that gone in VB .NET? -TC
2
by: nickheppleston | last post by:
I'm trying to iterate through repeating elements to extract data using libxml2 but I'm having zero luck - any help would be appreciated. My XML source is similar to the following - I'm trying to...
2
by: jcharth | last post by:
Hello I am trying to write a aspx webpage that grabs data from a access database. It seems to work but I am trying to avoid repeating all code. Can i declare i sub or function somewhere in the aspx...
4
by: wrldruler | last post by:
Hello, First, I know it's against "Access Law" to save calculations in a table, but....I want/need to. I currently have sub-totals being calculated inside a form, using DMax, DCount, and...
3
by: bagelman | last post by:
Hi, I want to find repeating words in a long string with Regular Expressions. I tried to write a regular expression but it didn't work. "\b(?<word>\w+)\s+(\k<word>)\b" This RegEx finds...
3
by: Robert | last post by:
Hi, I thought I pretty much understood the whole prototype chain stuff, but now I stumbled upon a difference between IE and Firefox, that is totally confusing me. An example.......
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.