我在使用 c# 网页的 ASP.NET 中有一个 StartDate 和 EndDate。当用户填写开始日期时 - 我希望将其复制到 enddate 直到用户更改结束日期。我们怎么可能做到这一点。我的代码如下
<asp:PlaceHolder ID="m_eventform" runat="server" Visible="true">
<script type="text/javascript">
$(function () {
$('#<%= m_eventDate.ClientID %>').datepick({ dateFormat: 'yyyy-mm-dd' });
$('#<%= m_eventEndDate.ClientID %>').datepick({ dateFormat: 'yyyy-mm-dd' });
});
</script>
<form id="eventForm" runat="server">
<div class="formrow">
<label>
Start Date</label>
<asp:TextBox ID="m_eventDate" runat="server" />
<asp:RequiredFieldValidator ID="m_eventDateRequired" runat="server" ControlToValidate="m_eventDate"
ErrorMessage="Please enter a start date" Display="Dynamic" />
<asp:RegularExpressionValidator ID="m_eventDateReg" runat="server" ValidationExpression="^\d{4}[\-]?((((0[13578])|(1[02]))[\-]?(([0-2][0-9])|(3[01])))|(((0[469])|(11))[\-]?(([0-2][0-9])|(30)))|(02[\-]?[0-2][0-9]))$"
ControlToValidate="m_eventDate" Display="Dynamic" ErrorMessage="Please enter the date in YYYY-MM-DD format" />
</div>
<div class="formrow">
<label>
End Date</label>
<asp:TextBox ID="m_eventEndDate" runat="server" />
<asp:RequiredFieldValidator ID="m_eventEndDateRequired" runat="server" ControlToValidate="m_eventEndDate"
ErrorMessage="Please enter an end date" Display="Dynamic" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ValidationExpression="^\d{4}[\-]?((((0[13578])|(1[02]))[\-]?(([0-2][0-9])|(3[01])))|(((0[469])|(11))[\-]?(([0-2][0-9])|(30)))|(02[\-]?[0-2][0-9]))$"
ControlToValidate="m_eventEndDate" Display="Dynamic" ErrorMessage="Please enter the date in YYYY-MM-DD format" />
</div>
</form>