RegularExpressionValidator打破了javascript ui datepiker

时间:2016-05-13 20:38:16

标签: javascript java c# asp.net datepicker

所以我正在开发一个asp.net网页。我正在使用带有javascript datepicker的asp:textbox,但是当我将一个正则表达式验证器放在另一个没有javascrips datepicker的文本框上时,我遇到了问题。日期选择器不会出现。但是一旦我删除了验证器就可以了。以下是我的aspx页面中的代码。让我知道我能做些什么才能让它发挥作用。

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h1>
    <asp:Label ID="lblPageHeaderTitle" runat="server" Text="Accident Report Form"></asp:Label>
</h1>
<script type="text/javascript">
    $(function () {
        $("#<%=txtDateOfInjury.ClientID%>").datepicker();
        $("#<%=txtFirstDataAway.ClientID%>").datepicker();
        $("#<%=txtLastDateLost.ClientID%>").datepicker();
        $("#<%=txtReturnToWorkDate.ClientID%>").datepicker();
        $("#<%=txtRestrictionStartDate.ClientID%>").datepicker();
        $("#<%=txtRestrictionEndDate.ClientID%>").datepicker();
        $("#<%=txtDateReturnJOI.ClientID%>").datepicker();
        $("#<%=txtDateOfDeath.ClientID%>").datepicker();
    });
</script>
<asp:Label ID="lblEmployeeInfo" runat="server" Font-Bold="true">Employee Information</asp:Label>
<asp:Panel ID="pnlEmployeeInfo" runat="server" Width="98%" BorderStyle="Solid" BorderWidth="1px">

    <table cellpadding="3" style="width: 100%">
        <tr>
            <td style="text-align: left; ">
                <strong><span style="color: #ff0000">&nbsp;&nbsp; * = Required</span></strong>
                &nbsp;&nbsp;
            </td>
        </tr>
        <tr>
            <td style="text-align: Right; color: black;">Accident #:
                    <asp:Label ID="lblAccidentReportNumber" runat="server"></asp:Label>
            </td>
        </tr>

<tr>
            <td style="text-align: right; color: black; ">Date of Birth:</td>
            <td style="text-align: left; ">
                <asp:TextBox ID="txtDateOfBirth" runat="server" ToolTip="mm/dd/yyyy" TabIndex="1" Wrap="False"></asp:TextBox>
                <asp:RegularExpressionValidator ID="valDateOfBirth" runat="server" ControlToValidate="txtDateOfBirth" ErrorMessage="Please Enter a valid date(mm/dd/yyyy)" ValidationExpression="^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d$"></asp:RegularExpressionValidator>

            </td>
            <td style="text-align: right; color: black; ">Data of Hire:</td>
            <td style="text-align: left; ">
                <asp:TextBox ID="txtDateOfHire" runat="server" ToolTip="mm/dd/yyyy" TabIndex="1" Wrap="False"></asp:TextBox>
            </td>
        </tr>
    </table>
    <br />
</asp:Panel>

<asp:Label ID="lblAccidentInformation" runat="server" Font-Bold="True">Accident Information</asp:Label>
<asp:Panel ID="pnlAccidentInformation" runat="server" Width="98%" BorderStyle="Solid" BorderWidth="1px">
    <br />
    <table cellpadding="3" style="width: 100%">
        <tr>
            <td style="text-align: right; color: black;">Location of Accident:</td>
            <td style="text-align: left;">
                <asp:TextBox ID="txtAccidentLocation" runat="server" ></asp:TextBox>
            </td>
            <td style="text-align: right; color: black; ">Accident Type:</td>
            <td style="text-align: left;">
                <asp:DropDownList ID="ddlAccidentType" runat="server" ></asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td style="text-align: right; color: black; ">Incident Time:</td>
            <td style="text-align: left;">
                <asp:TextBox ID="txtIncidentTimeHour" runat="server" ></asp:TextBox> &nbsp : &nbsp
                <asp:TextBox ID="txtIncidentTimeMinuet" runat="server" ></asp:TextBox>
                <asp:RadioButton ID="btnIncidentTimeAM" runat="server"  Text="AM"></asp:RadioButton>
                <asp:RadioButton ID="btnIncidentTimePM" runat="server"  Text="PM"></asp:RadioButton>
            </td>
            <td style="text-align: right; color: black;">Doing Before Incident:</td>
            <td style="text-align: left;">
                <asp:TextBox ID="txtDoingBeforeIncident" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="text-align: right; color: black; ">Date of Injury:</td>
            <td style="text-align: left;">
                <asp:TextBox ID="txtDateOfInjury" runat="server"></asp:TextBox>

            </td>

0 个答案:

没有答案