.net 頁面通過C#控件綁定時間格式的方法

下面是項目中.net 頁面的關於<asp:TextBox/> 標籤 綁定時間格式的幾種方法。

1,通過<ajax:CalendarExtender> 

  就診時間:<asp:TextBox ID="starttime" runat="server" Width="158px"></asp:TextBox>到<asp:TextBox ID="endtime" runat="server" Width="158px"></asp:TextBox>
                <asp:CompareValidator  ControlToCompare="starttime" ID = "statttime1" runat ="server" Type="Date"      ControlToValidate="endtime" ErrorMessage="開始時間>結束時間" Operator="GreaterThanEqual"></asp:CompareValidator>
                 <ajax:CalendarExtender runat ="server" TargetControlID="endtime" ID="calendar1"></ajax:CalendarExtender>
                 <ajax:CalendarExtender runat="server" TargetControlID = "starttime" ID = "calendar2"></ajax:CalendarExtender>

2,
 <td  align="left" style="width: 83px">休養開始時間:</td>
<td  align="left" style="width: 131px" >
      <asp:TextBox ID="SelfCultivationBtime" onchange="CheckTimeRangeForClinic()" runat="server" onclick="WdatePicker({startDate:'%y/%M/%d 00:00',dateFmt:'yyyy/MM/dd HH:mm'})"></asp:TextBox></td>
<td style="width: 77px" >休養結束時間:</td>
<td style="width: 132px" >
      <asp:TextBox ID="SelfCultivationEtime" runat="server"   onchange="CheckTimeRangeForClinic()" onclick="WdatePicker({startDate:'%y/%M/%d 00:00',dateFmt:'yyyy/MM/dd HH:mm'})" ></asp:TextBox></td>
  <td colspan="2"  >
 <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="SelfCultivationBtime"ControlToValidate="SelfCultivationEtime" ErrorMessage="休養開始時間>休養結束時間" Operator="GreaterThanEqual">*</asp:CompareValidator>( 格式:yyyy/mm/dd hh:ii 例如:2001/01/01 08:00 )</td>
                       

posted @ 2013-11-09 10:55  洽洽果  阅读(401)  评论(0编辑  收藏  举报