新手求教 源码<%%>这个标记的问题
<font color="white">今天是:</font><asp:Label ID="labDate" runat="server" Font-Names="宋体"
ForeColor="White"><%# System.DateTime.Now.ToLongDateString() %></asp:Label>
我想在页面加载时就让用户看到时间
但是当页面出来时,就只看到今天是: 不知道为什么啊
源码:
<body>
<form id="form1" runat="server">
<div id="container">
<div id="header">
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<font color="white">今天是:</font><asp:Label ID="labDate" runat="server" Font-Names="宋体"
ForeColor="White"><%# System.DateTime.Now.ToLongDateString() %></asp:Label>
</td>
<td>
<asp:Button ID="Button1" runat="server" Text="请登录" /></form>
</td>
<td>
<asp:HyperLink ID="HyperLink1" runat="server">免费注册</asp:HyperLink>
</td>
</tr>
</table>
<img id="logo" src="image/01.jpg" height="70px" />
------解决方案--------------------你应该绑定 Label 控件的 Text 属性。
------解决方案--------------------</font><asp:Label ID="labDate" runat="server" Font-Names="宋体"
ForeColor="White"><%# System.DateTime.Now.ToLongDateString() %></asp:Label>
改为:
</font><asp:Label ID="labDate" runat="server" Font-Names="宋体"