January 26, 2012

Write server side asp .net code in tridion DWT

DWT has its own language, but sometime we need server side Tags in dwt tbb.

Example: Suppose you have some string and you want to format it, or want to do some operation on data which is not possible in DWT. you can use following code.



<% if(condtion) {%>

<%=String.Format("@@Variable@@","first","second")%>
<%="@@CAR@@".Replace("INR","Indian Rupee") %>
<% }%>


Keep in mind. DWT will no execute the .net code snippet, it will be rendered as its on .aspx page.

when this page is requested through browser then this asp.net code snippet executes.
& format or replace the strings etc.

if you have any question, just comment. i will try to reply ASAP






No comments: