I am brand new to Castle (today is my first day). It always produces
"No partners found". I also tried it in an IList (if you want to see
the code). I wish it would at least crash. I have tried everything I
can on the web so can someone point me in the right direction?
I have the following:
List<Customer> lstCustomer = new List<Customer>();
Customer oCustomer1 = new Customer();
oCustomer1.name = "aaaa";
lstCustomer.Add(oCustomer1);
Customer oCustomer2 = new Customer();
oCustomer2.name = "bbbb";
lstCustomer.Add(oCustomer2);
Customer oCustomer3 = new Customer();
oCustomer3.name = "cccc";
lstCustomer.Add(oCustomer3);
VelocityEngine velocity = new VelocityEngine();
ExtendedProperties props = new ExtendedProperties();
props.SetProperty("file.resource.loader.path",
Server.MapPath(".")); // The base path for Templates
velocity.Init(props);
Template template = velocity.GetTemplate(@"testTemplate.vm");
VelocityContext context = new VelocityContext();
context.Put("from", "Jennifer");
context.Put("to", "Our Wholesaler");
context.Put("subject", "Partner request from retailer");
context.Put("name", lstCustomer);
public class Customer
{
public virtual string name { get; set; }
}
The template is:
#foreach($Customer in $lstCustomer)
#beforeall
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tr>
<th >Name</th>
</tr>
#odd
<tr class="">
#even
<tr>
#each
<td>$Customer.name </td>
#after
</tr>
#afterall
</table>
#nodata
No partners found
#end
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.