/ Published in: C#

* The
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <p>Equals: <%= this.TestValue %></p> <p>Pound: <%# this.TestValue %></p> <p>Equals label: <asp:Label runat="server" ID="_equals" Text="<%= this.TestValue %>" /></p> <p>Pound label: <asp:Label runat="server" ID="_pound" Text="<%# this.TestValue %>" /></p> </div> </form> </body> </html> //And the code behind is: public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { _testValue = "2"; } protected void Page_PreRenderComplete(object sender, EventArgs e) { // DataBind(); _testValue = "3"; } public string TestValue { get { return _testValue; } } private string _testValue = "1"; }
URL: http://blogs.msdn.com/dancre/archive/2007/02/13/the-difference-between-lt-and-lt-in-asp-net.aspx
Comments
