More in this section
Blogs RSS feed

Sitefinity template parser: The differences

by User Not Found

[This post is part of the developer's manual preview published on this blog. You can find temporary TOC here.] 

As it was stated, Sitefinity template parser is almost completely identical to the ASP.NET template parser (and purposefully so). There are, however, some differences between the two and in this article we are going to examine them.

Case sensitivity

Sitefinity template parser is case sensitive, which means that this declaration:
<telerik:MessageControl runat="server" ID="messageCtrl"
        <asp:Label ID="messageText" runat="server"></asp:Label> 
Is not same as this declaration:
<telerik:messagecontrol runat="server" ID="messageCtrl"
        <asp:Label ID="messageText" runat="server"></asp:Label> 
Sitefinity template parser expects the declarations have correct casing. So if the name of the class (control) is MessageControl first declaration will be correct. If the name of the class (control) is messagecontrol second declaration will be correct.


No need for casting

One of the nice, built-in things regarding Sitefinity template parser is the fact that you don’t need to explicitly cast the types you use there. Let us consider the proper usage of the property in standard ASP.NET template parser:
<href="<%= ((Telerik.Events.WebControls.Admin.EventsItemsList)Parent.Parent).ItemEditUrl %>">edit</a> 
If you are using Sitefinity template parser, the line above can be rewritten as follows:

<href="<%= Parent.Parent.ItemEditUrl %>">edit</a> 
And those are all the differences between the two parsers. As you can see, interoperability should not be a problem. In order to make all your templates work with both parsers, you should properly cast all the controls and use explicit casting.

Leave a comment