0

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 ?

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.