Dynamicweb 8 Documentation
GetLoop Method
Example 

The name.
Gets a loop.
Syntax
'Declaration
 
Public Function GetLoop( _ 
   ByVal name As String _ 
) As Template
public Template GetLoop( 
   string name 
)

Parameters

name
The name.

Return Value

An instance of template representing the markup of the loop.
Example
Template usage example with loopTemplate usage example with loop
'Load a template from /Files/Templates/MyFolder/MyTemplate.html
Dim t As New Template("MyFolder/MyTemplate.html")
'Set a tag value 
t.SetTag("MyTag", "Hello world!")
 
'Create a loop in the template
Dim loopTemplate As Template = t.GetLoop("MyLoop")
For Each p As Content.Page In Content.Page.GetPagesByAreaID(1)
	loopTemplate.SetTag("PageName", p.MenuText)
	loopTemplate.CommitLoop()
Next
 
'Return the parsed template
Return t.Output()
Template t = new Template("MyFolder/MyTemplate.html");
//Set a tag value 
t.SetTag("MyTag", "Hello world!");
 
//Create a loop in the template
Template loopTemplate = t.GetLoop("MyLoop");
foreach (Content.Page p in Content.Page.GetPagesByAreaID(1)) {
	loopTemplate.SetTag("PageName", p.MenuText);
	loopTemplate.CommitLoop();
}
 
//Return the parsed template
return t.Output();
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Template Class
Template Members

Send Feedback