The <%= expressions are evaluated at render time
The <%# expressions are evaluated at DataBind() time and are not evaluated at all if DataBind() is not called.
The <%# expressions can be used as properties in server-side controls. <%= expressions cannot.
//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";
}
No comments:
Post a Comment