A Page is transactional when the page needs to perform certain actions that require Server Side coding. If you want to implement the page in SharePoint and so End user can change the style of the Page through SharePoint designer, you have to implement the Server Side code in a Custom code behind Page class. You can place all the UI components in the SharePoint page or Page Layout in case of a publishing page. The code behind custom Page class will handle the server side logic. This approach will allow Designers to change the look/feel of the page through SharePoint designer while leaving the server side logic to developer. Allowing Designers to customize without any code change is the advantage to use SharePoint here.
The problem with this approach is that the Server Side logic is tied up with the page and so is not so reusable. What presented here is to use “Template” user controls/Custom controls to achieve the same functionality in a more reusable fashion. Basically, the all the UI components will be inside the “Template” properties of the User/Custom Controls. Therefore, they can be placed inside the SharePoint Page and End users can customize the templates through SharePoint designer.
It is not a new idea. It is exactly what ASP.Net “template” is designed for. It allows customized UI tied up to the same Server Side Logic. A good example is ASP.NET 2.0 login control, in which you can customize the layout of all the UI components while using for the same server side logic. The same idea applies perfectly in the context of SharePoint. SharePoint allows Users to customize the UI components through SharePoint designer while allowing certain degree of Server Side Activities. So, while writing User Controls for SharePoint projects, think about exposing “Template” properties and make them customizable through SharePoint Designer.
It is not so difficult to write a “template” controls. Please follow the link to learn how to add templates to a ASP.NET user controls http://weblogs.asp.net/scottgu/archive/2006/06/04/Supporting-Templates-with-ASP.NET-User-Controls.aspx
No comments:
Post a Comment