ASP.net Special Tags
Tuesday, 22 May 2007
Anyone exposed to ASP.net syntax will come to realize
Here is a page example that contains typical tags (sorry about the space between < and tag names, :
<%@ Page Language="VB" %> <html> <body> <!-- #Include virtual="/include/header.inc" --> <%-- Server Side Comment --%> <script runat="server" language="VB"> Dim m_UserName As String = "Chui" Function MyFunction() As String return "Hello" End Function Sub called_when_page_is_rendered() ' Inside Private Sub __RenderContent1 End Sub </script> <asp:Label id="Label1" Text='<%# MyFunction() %>' runat="server" /> <%-- Also try Custom Expression Builders %$ ConnectionStrings:LocalSqlServer %$ Resources:NameOfResxFile, LBL_HELLO --%> <asp:Label id="Label4" Text="<%$ AppSettings:Foo %>" runat="server" /> <% called_when_page_is_rendered() %> <%= m_UserName %> </form> </body> </html>For further reference, consult the Microsoft ASP.net Page Syntax for Special Tags. OdeToCode's shows how databinding expressions are translated into VB or C# code.Public Sub __DataBindingLabel1(ByVal sender As Object, ByVal e As System.EventArgs) Dim dataBindingExpressionBuilderTarget As System.Web.UI.WebControls.Label Dim Container As System.Web.UI.Control dataBindingExpressionBuilderTarget = CType(sender,System.Web.UI.WebControls.Label) Container = CType(dataBindingExpressionBuilderTarget.BindingContainer,System.Web.UI.Control) #ExternalSource("C:\Doc...\Chui\My Documents\Visual Studio 2005\WebSites\WebSite1\Default.aspx dataBindingExpressionBuilderTarget.Text = _ System.Convert.ToString( MyFunction() , _ System.Globalization.CultureInfo.CurrentCulture) #End ExternalSource End SubReferences: