这个模板引擎还算不错,对于asp.net的分层架构还是很有帮助的。现在都流行mvc模式。可以研究一下。

<ad:foreach collection="#collection#" var="cust" index="i">
    #cust.lastname#, #cust.firstname# <br />
</ad:foreach>

模板是这样的,那么代码如下

 

TemplateManager template = TemplateManager.FromString(Res.c1);

ArrayList list = new ArrayList();
list.Add(new customer("Tom" , "Whatever"));
list.Add(new customer("Henry" , "III"));
list.Add(new customer("Tom" , "Jackson"));
template.SetValue("collection" , list);


string html = template.Process();

这样就生成了html。

更多的帮助文档可以看看这里:http://www.codeproject.com/Articles/8141/Ader-Template-Engine#xx2238055xx

相关文章:

  • 2021-07-18
  • 2022-01-25
  • 2021-11-17
  • 2021-12-05
  • 2022-12-23
  • 2021-11-27
  • 2022-01-18
  • 2021-09-24
猜你喜欢
  • 2021-10-02
  • 2022-02-19
  • 2021-08-27
  • 2021-07-22
  • 2021-05-15
  • 2021-12-19
  • 2022-03-07
相关资源
相似解决方案