我目前正在使用JQuery Datepicker与标签和文本框进行比较。
我已将标签日期格式转换为日期格式( "dd, MMMM, yyyy")
,并将值设置为后面代码的隐藏字段。
我使用<asp:HiddenField ID="hdfdate" runat="server" />
逻辑应该是:
txtShipmentDate
的日期不能早于lblDateReceived
日期选择器不能使用以下代码。关于此问题的需要建议
VB.Net背后的代码
Dim datereceived As DateTime = lblDateReceived.Text
Dim format As String = "dd, MMMM, yyyy"
Dim newdate = datereceived.ToString(format)
hdfdate.Value = newdate
ASPX
<asp:TextBox ID="txtShipmentDate" runat="server" Visible="False"></asp:TextBox>
<asp:Label ID="lblDateReceived" runat="server" Text="Label"></asp:Label>
<asp:HiddenField ID="hdfdate" runat="server" />
<link rel="stylesheet"href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js">
</script><link rel="stylesheet" href="/resources/demos/style.css">
<script type="text/javascript">
//add on this code to make jquery work in update panel
function pageLoad() {
$(function () {
$("#" + '<%=txtShipmentDate.ClientID%>').unbind();
$("#" + '<%=txtShipmentDate.ClientID%>').datepicker({
dateFormat: "dd, MMMM, yyyy",
onClose: function () {
$("#" + '<%=hdfdate.ClientID%>').datepicker(
"change",
{ minDate: new Date($("#" + '<%=txtShipmentDate.ClientID%>').val())
});
}
});
}
</script>