Developer Forum »
Best practices for accessing data in templates
5 posts

I have noticed there are many ways to render content in templates.

You can use inline code:

<%= WAFContext.Request.GetContent<WAF.Engine.Content.MySite.Restaurant>().Name%> 

or visit controls like:

 <waf:ShortStringVisitPropertyControl runat="server" PropertyName="Restaurant.Name" />

or using code behind:

myHtmlControl.Text = "test"; 

Are there any best practices? Any performance issues using any of these?

181 posts

As you say, there are multiple ways of accessing data in templates. All of the different solutions have different strenghts and weaknesses, but performance wise, the rendering method will rarely impact the speed of your site. 

Personally, I like to separate code and markup, so in most cases I don't use inline code.

1