Posted on 25/04/2008 09:30:33
I addapted your example til C# And edited a bit, but i can seem to get the loop going.
My code looks like this:
----
Dynamicweb.Templatev2.Template ResultTemplate = new Dynamicweb.Templatev2.Template( "ADSearch/" + Properties.get_Value( "ResultTemplate" ) );
User user = new User();
Dynamicweb.Templatev2.Template SearchLoop = ResultTemplate.GetLoop( "SearchResult" );
List<User> AllUsers = user.GetUsersFromSearch( "Martin"); // This object containes 5 users.
foreach ( User U in AllUsers ) {
SearchLoop.SetTag("cm.Name", U.FirstName + " " + U.Initials + " " + U.LastName);
SearchLoop.SetTag("cm.Email", U.Email);
SearchLoop.SetTag("cm.Department", U.Department);
SearchLoop.SetTag("cm.Phone", U.Phone);
SearchLoop.SetTag("cm.Country", U.Country);
SearchLoop.SetTag("cm.Local", U.LocalNumber);
}
ResultTemplate.SetTag( "cm.ResultCount", AllUsers.Count.ToString() );
ResultTemplate.SetTag( "cm.SearchWord", SearchWord );
ResultTemplate.SetTag( "cm.PostBack", PostBack.ToString() );
Return ResultTemplate.Output;
----
In my template i use the following templatetags to get me loop, but nothing is returned:
<!--@LoopStart(SearchResult)-->
<!--@DwTemplateTags-->
<!--@LoopEnd(SearchResult)-->
My "cm.ResultCount" and "cm.SearchWord" are returned just fine. did i do something wrong?