views:

26

answers:

1

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 ?

+2  A: 

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

AMissico
Thank you that's it.