NVelocity.App.Tools.VelocityFormatter.MakeAlternator C# (CSharp) Method

MakeAlternator() public method

Makes an alternator object that alternates between two values.

Example usage in a Velocity template: <table> $formatter.makeAlternator("rowcolor", "#c0c0c0", "#e0e0e0") #foreach $item in $items <tr><td bgcolor="$rowcolor">$item.Name</td></tr> $rowcolor.alternate() #end </table>

public MakeAlternator ( String name, String alt1, String alt2 ) : String
name String The name for the alternator int the context.
alt1 String The first alternate.
alt2 String The second alternate.
return String
		public String MakeAlternator(String name, String alt1, String alt2)
		{
			context.Put(name, new VelocityAlternator(alt1, alt2));
			return "";
		}

Same methods

VelocityFormatter::MakeAlternator ( String name, String alt1, String alt2, String alt3 ) : String
VelocityFormatter::MakeAlternator ( String name, String alt1, String alt2, String alt3, String alt4 ) : String