Reputation: 38190
I'm just testing a simple databind expression with:
<div>
Now: <%# DateTime.Now.ToString()%>
</div>
According to MSDN: http://msdn.microsoft.com/en-us/library/bda9bbfx(VS.71).aspx
literal text <%# data-binding expression %>
should work.
When I compile, it's OK but I got a blank instead of Now DateTime.
What's wrong ?
Upvotes: 0
Views: 184
Reputation: 21684
You must call a DataBind method. In this case, add a call to the Page.DataBind in the page's load event. The DataBind method is not called automatically. You must call it for the page or for specific controls.
ASP.NET data binding overview at http://support.microsoft.com/kb/307860
Upvotes: 4