为何 TEXTBOX 无法用<%#%> 绑定日期

为何TEXTBOX不显示任何东西?

 <asp:TextBox ID="TextBox_startdate" runat="server" Text='<%# System.DateTime.Today.ToShortDateString() %>'></asp:TextBox>

1:<%#Eval("")%>
2:<%#Bind("")%>
3:<%=变量%>

<%#Eval("")%> 和<%#Bind("")%>直接绑定字段名。
如何您想获取当前时间,那就定义一个全局变量获取当前时间的值可以用 <%=变量%> 写法绑定。

$(function() {

var myDate = new Date(); //动态获取当前时间

var Years = myDate.getFullYear(); //获取当前年
var Months = myDate.getMonth() + 1; //获取当前日

var Dates = myDate.getDate(); //获取当前月

var Hours = myDate.getHours(); //获取当前的时

var Minutes = myDate.getMinutes(); //获取当前的分

var Seconds = myDate.getSeconds(); //获取当前的秒

$('#控件ID').val(Years);   //将获取的当前年赋值给控件

//如果想获取具体时间,年月日时分秒,如下:
Months = Months < 10 ? '0' + Months : Months; Dates = Dates < 10 ? '0' + Dates : Dates; Hours = Hours < 10 ? '0' + Hours : Hours; Minutes = Minutes < 10 ? '0' + Minutes : Minutes; Seconds = Seconds < 10 ? '0' + Seconds : Seconds; var currentTime= Years + '年' + Months + '月' + Dates + '日' + ' ' + Hours + ':' + Minutes + ':' + Seconds;
$('#控件ID').val(Years); //将想获取具体时间,年月日时分秒赋值给控件
});

<%#Eval("")%> 和<%#Bind("")%>直接绑定字段名。
如何您想获取当前时间,那就定义一个全局变量获取当前时间的值可以用 <%=变量%> 写法绑定。