Render DateTime.Now directly in the ASPX page

前端 未结 2 1416
感情败类
感情败类 2021-02-10 00:35

I am trying to do the following directly into the aspx page but it is not showing the date value. I dont want to do it from the code behind. Am i missing something small here? P

2条回答
  •  隐瞒了意图╮
    2021-02-10 01:03

    When using a databinding expression such as <%# DateTime.Now.ToLongTimeString() %>, then you have to call Page.DataBind() (or ltrDate.DataBind() if that's the only databound control) from your code-behind (e.g. in Page_Load).

提交回复
热议问题