gpt4 book ai didi

c# - 如何启用退格键,删除到 maskededitextender 日期字段

转载 作者:太空宇宙 更新时间:2023-11-03 12:17:19 25 4
gpt4 key购买 nike

我有一个文本框作为日期字段。但由于屏蔽编辑器扩展器,我无法在 chrome 或 firefox 退格键中编辑日期,并且删除在 chrome 或 firefox 中不起作用。

代码如下

   <asp:TextBox ID="txtStartDate"  CssClass="txtStartDate" runat="server" MaxLength="10"    onkeydown="return allowBackSpace(event);" />&nbsp;
<asp:RequiredFieldValidator ID="startDateRequiredFieldValidator" runat="server" ValidationGroup="Dates" ControlToValidate="txtStartDate"
EnableClientScript="True" Display="None" Text="*" ErrorMessage="Start date is required."/>
<asp:CompareValidator ForeColor="Red" id="startDateCompareValidator1" runat="server" Type="Date"
ValidationGroup="Dates" Display="None" EnableClientScript="True"
Operator="DataTypeCheck" ControlToValidate="txtStartDate" Text="*"
ErrorMessage="Start date is not valid or is in an incorrect format. Please use the format yyyy-MM-dd."/>
<asp:RangeValidator id="ReturnDateRangeValidator" runat="server" ControlToValidate="txtStartDate" ValidationGroup="Dates"
MinimumValue="2005-01-01" MaximumValue="2050-01-01" Display="None" EnableClientScript="True" Text="*"
ErrorMessage="Start date is too far back in time or it is to far in future, please enter a more feasible date."/>
<cc1:CalendarExtender ID="Calendarextender2" runat="server" Format="yyyy-MM-dd" PopupButtonID="Image2"
TargetControlID="txtStartDate" FirstDayOfWeek="Monday">
</cc1:CalendarExtender>
<cc1:MaskedEditExtender ID="maskStartDate" runat="server" Century="2000" CultureName="sv-SE"
Mask="9999/99/99" MaskType="Date" TargetControlID="txtStartDate" AutoComplete="False" />
<cc1:MaskedEditExtender ID="maskStartTime" runat="server" Century="2000" CultureName="sv-SE"
Mask="99:99" MaskType="Time" TargetControlID="txtStartTime" AutoComplete="false" />
<cc1:MaskedEditExtender ID="maskStopDate" runat="server" Century="2000" CultureName="sv-SE"
Mask="9999/99/99" MaskType="Date" TargetControlID="txtStopDate" AutoComplete="False" />
<cc1:MaskedEditExtender ID="maskStopTime" runat="server" Century="2000" CultureName="sv-SE"
Mask="99:99" MaskType="Time" TargetControlID="txtStopTime" AutoComplete="false" />

我编写了 javascript onleydown 函数来允许退格,但它不起作用..

   <script type="text/javascript" language="javascript">
function allowBackSpace(event) {

var key = window.event ? event.keyCode : event.which;
//alert(key);
if (event.keyCode == 8) {
alert(key);
return true;
}
else if (key < 48 || key > 57) {
return false;
}
else return false;
}
</script>

onkeydown 调用

     <asp:TextBox ID="txtStartDate"  CssClass="txtStartDate" runat="server" MaxLength="10"    onkeydown="return allowBackSpace(event);" />

最佳答案

解决方案

下载ajaxcontroltoolkit最新版本18.0.0。他们将此错误解决为新的更新版本

关于c# - 如何启用退格键,删除到 maskededitextender 日期字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49149067/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com