Monday, November 1, 2010

All about ASP.NET Inline Server Tags <%, <%# etc

<% %> An embedded code block is server code that executes during the page's render phase. The code in the block can execute programming statements and call functions in the current page class. http://msdn2.microsoft.com/en-gb/library/ms178135(vs.80).aspx

<%= %> most useful for displaying single pieces of information.
The Date is now <%= DateTime.Now.ToShortDateString() %>
The value of string1 is <%= string1 %>
http://msdn2.microsoft.com/en-us/library/6dwsdcf5(VS.71).aspx

<%# %> Data Binding Expression Syntax. http://msdn2.microsoft.com/en-us/library/bda9bbfx.aspx

<%$ %> ASP.NET Expression. http://msdn2.microsoft.com/en-us/library/d5bd1tad.aspx

<%@ %> Directive Syntax. http://msdn2.microsoft.com/en-us/library/xz702w3e(VS.80).aspx

<%-- --%> Server-Side Comments. http://msdn2.microsoft.com/en-US/library/4acf8afk.aspx


This is NOT possible; using server tags inside of control properties

or this(using the quotes)
/>

To be able to use inline tags in the properties, you have to write Expression Builders:
http://weblogs.asp.net/infinitiesloop/archive/2006/08/09/The-CodeExpressionBuilder.aspx

Very Detailed description of the tags:
http://weblogs.asp.net/ahmedmoosa/archive/2010/10/06/embedded-code-and-inline-server-tags.aspx

one more link:
http://naspinski.net/post/inline-aspnet-tags-sorting-them-all-out-(3c25242c-3c253d2c-3c252c-3c252c-etc).aspx

No comments:

Post a Comment