Nested Repeat Regions in ASP

Here some code and a tutorial on how to create a nested repeat region in ASP:-

http://www.donenet.co.uk/tutorials/nested%5Frepeat/nested%20repeat.html

The Code:-

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../../Connections/connDN.asp" -->
<%
Dim rsNewsletter
Dim rsNewsletter_numRows

Set rsNewsletter = Server.CreateObject("ADODB.Recordset")
rsNewsletter.ActiveConnection = MM_connDN_STRING
rsNewsletter.Source = "SELECT *  FROM tblNewsletter  ORDER BY NLID ASC"
rsNewsletter.CursorType = 0
rsNewsletter.CursorLocation = 2
rsNewsletter.LockType = 1
rsNewsletter.Open()

rsNewsletter_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rsNewsletter_numRows = rsNewsletter_numRows + Repeat1__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Nested Repeat Region</title>
</head>

<body>
<% 
While ((Repeat1__numRows <> 0) AND (NOT rsNewsletter.EOF)) 
%>
<%
Dim rsNewletterTopic__varNLID
rsNewletterTopic__varNLID = "0"
If (rsNewsletter("NLID") <> "") Then 
  rsNewletterTopic__varNLID = rsNewsletter("NLID")
End If
%>
<%
Dim rsNewletterTopic
Dim rsNewletterTopic_numRows

Set rsNewletterTopic = Server.CreateObject("ADODB.Recordset")
rsNewletterTopic.ActiveConnection = MM_connDN_STRING
rsNewletterTopic.Source = "SELECT *  FROM tblNewsletterTopic  WHERE NLID = " + Replace(rsNewletterTopic__varNLID, "'", "''") + ""
rsNewletterTopic.CursorType = 0
rsNewletterTopic.CursorLocation = 2
rsNewletterTopic.LockType = 1
rsNewletterTopic.Open()

rsNewletterTopic_numRows = 0
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index

Repeat2__numRows = -1
Repeat2__index = 0
rsNewletterTopic_numRows = rsNewletterTopic_numRows + Repeat2__numRows
%>
  <%=(rsNewsletter.Fields.Item("NLTitle").Value)%><br />
<% 
While ((Repeat2__numRows <> 0) AND (NOT rsNewletterTopic.EOF)) 
%>
  <%=(rsNewletterTopic.Fields.Item("NLTName").Value)%><br />
  <% 
  Repeat2__index=Repeat2__index+1
  Repeat2__numRows=Repeat2__numRows-1
  rsNewletterTopic.MoveNext()
Wend
%>  
<br />
<%
rsNewletterTopic.Close()
Set rsNewletterTopic = Nothing
%>
<% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsNewsletter.MoveNext()
Wend
%>
</body>
</html>
<%
rsNewsletter.Close()
Set rsNewsletter = Nothing
%>

Hope it all makes sense…

Advertisements

April 8, 2007 at 11:27 pm 1 comment

Merry Xmas

Merry Xmas everyone, my New Years resolution will be to try and post more often.  I will try and get some ASP stuff together but am struggling for ideas at present, so if you guys think of anything let me know and I’ll see what I can do.

Idea’s on the back of a postcard to https://donenet.wordpress.com&#8230; LOL

December 21, 2006 at 12:38 pm 1 comment

Site Relaunched

New Look Site

Ok I know I haven’t been posting a lot lately but I have plenty of excuses, one of them is the re-launch of the DoneNet website – www.donenet.co.uk.  The main reson for the change was to conform to DDA (Disability Discrimination Act) standards, using XHTML and CSS and to get rid of all those horrible tables.  The technology used was as follows:-

  • ASP
  • MS Access
  • XHTML
  • CSS
  • AJAX (See Examples Section)

I am looking to push for new projects in New Year; I have 2 on the go at present, one for a law firm which will be launching in January and the other being a community based website for my local community council.

If you have any comments on the new look Donenet site please let me know? 

December 21, 2006 at 12:31 pm 1 comment

Tagged By Moody

He he Moody you finally got me to make a post…..

Heres the rules——

  • Grab the closest book to you
  • Open Page 123
  • Scroll down to the 5th sentence
  • Post the next 3 sentences on your blog
  • Name the book and author
  • Tag 3 people

—————————————–

As with the cookies collection, redirection, and buffering, we must add headers befor the server parses the <HTML> tag in our Active Server Pages.

To allow proxy servers to cache output, generated by our ASP pages, we can use the cachecontrol property.

This property can have two values-public or private.  If the value of this property is public, the output will be caqched by proxy servers.

—————————————–

Name of book:- Professional  Active Server Pages 2.0 by Wrox

—————————————–

I Tag:

  1.  Twilight Town
  2. D.a.double-r.e.n
  3. kevdotbadger

Get blogging people…..

Hey Moo, the  persistant nagging paid of…. LOL

December 21, 2006 at 12:05 pm 1 comment

It’s been a while

It’s been a while since my last post but I was gutted when England were dumped out of the world cup, but look out i’m back and i’m gonna be doing some more ASP (any suggestions?)

August 2, 2006 at 9:13 am 3 comments

We’re Out Boo Hoo

Well it finally happened on Saturday, the bloody lucky cheating  Portuguese gets knocked us out on penalties.  I havn’t been able to sit at a computer since due to the agony of the coverage on the web….

Well I’m back now and looking forward to Euro 2008, we have a good chance as the group is a fantastic draw for us.

I will be developing some new ASP tips and tricks very soon and will probably theme them around footie, if you have any requests then drop me a comment or e-mail…

July 4, 2006 at 4:35 pm 6 comments

Working with variables in ASP

OK here's a short one, this example shows you how do the basics with variables, it demonstrates how to do a simple bit of maths on a shopping cart.
<%

dim vCART,vSHIPPING,vTOTAL

vCART = 47.99 'this variable would hold the total cart price including VAT, you would probably hold this information in a session variable but for this example I have hard coded the price in

vSHIPPING = 3.99
vTOTAL = vCART+vSHIPPING 'this variable will give the total price including shipping

%> 

To write the total out on the web page all you have to do is:-

<%=vTOTAL%> 

And thats it. 

June 21, 2006 at 10:14 pm 3 comments

Older Posts


Categories

  • Blogroll

  • Feeds