问题描述
我有一个Asp.Net网页,其中有一个带日历扩展程序的文本框,当用户输入日期时,在处理网格数据时应加载加载动画。我有以下代码(Jquery,HTML)仅适用当用户使用扩展名输入日期时,而不是在用户键入日期时。应用Ajax UpdateProgress之后,我的解决方案都无法正常工作。任何建议都会有所帮助。
$(document).ready(function () {
$("[id$='ddlCountry'],[id$='DateTxtBox']").change(function () {
$('.blockMe').block({
message: 'Loading...',css: { padding: '10px' }
});
});
});
<table style="width:100%">
<tr>
<td>
<div style="padding-top: 10px; padding-right: 60px; padding-bottom: 5px; width: 100%; overflow: hidden" class="table-responsive">
<table style="margin-left: 30px; margin-top:20px; width:100%;">
<tr>
<td style="padding-left:5%; padding-top:10px; padding-bottom:10px;">
<asp:Label ID="DateFromlbl" class="text-muted" Style="font-size: 13px; text-align: right; font-weight: 600" Text="Date From (MM/dd/yyyy):" runat="server"></asp:Label>
<asp:TextBox ID="DateTxtBox" Style="font-size: 10px; font-weight: 600" Width="80px" Height="20px" AutopostBack="true" OnTextChanged="DateTxtBox_OnTextChanged" runat="server" />
<asp:Image ID="CalendarImg" runat="server" Width="18px" Height="18px" ImageUrl="~/DailyDownloads/Images/Calendar.PNG" />
<cc1:CalendarExtender ID="DateFromCalenderExt" runat="server" TargetControlID="DateTxtBox" PopupButtonID="CalendarImg"></cc1:CalendarExtender>
<asp:requiredFieldValidator runat="server" ForeColor="Red" id="reqName" controltovalidate="DateTxtBox" errormessage="Date required"/>
<asp:RegularExpressionValidator ValidationExpression="^([0-9]|0[1-9]|1[012])\/([0-9]|0[1-9]|[12][0-9]|3[01])\/(19|20)\d\d$" ID="dateValidator"
ControlTovalidate="DateTxtBox" ForeColor="Red" ErrorMessage="Invalid Date Format. Use MM/DD/YYYY" runat="server"></asp:RegularExpressionValidator>
</td>
</tr>
<tr><td>
<table style="width:100%;">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID ="p1" runat="server">
<td>
<asp:Label ID="Countrylbl" Style="font-size: 13px; text-align: right; font-weight: 600" class="text-muted" Text="Agencies:" runat="server"></asp:Label>
<asp:DropDownList ID="ddlCountry" Style="width: 200px;" class="btn btn-primary btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" Width="50%" runat="server" AutopostBack="true" OnSelectedindexChanged="ddlMunicipality_OnSelectedindexChanged" AppendDataBoundItems="true">
<asp:ListItem Text="All" Value="ALL"></asp:ListItem>
</asp:DropDownList>
</td>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DateTxtBox" EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel>
</tr></table>
</td>
</tr>
<tr>
<td colspan="4">
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="blockMe">
<asp:GridView EnableEventValidation="false" ID="EmpGrd" ShowHeaderWhenEmpty="true" runat="server" AutoGenerateColumns="false" AllowPaging="true"
AllowSorting="true" PageSize="25" Width="100%" OnPageIndexChanging="EmpGrd_PageIndexChanging" OnSorting="EmpGrd_Sorting" FooterStyle-BackColor="Black" CssClass="table table-condensed table-hover">
<Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%">
<asp:BoundField datafield="EmpID" HeaderText="EmpID" ItemStyle-Width="10%" ItemStyle-Wrap="false" ReadOnly="True" SortExpression="MtgRef" />
<asp:BoundField datafield="Name" HeaderText="Name" ItemStyle-Width="25%" ItemStyle-Wrap="false" SortExpression="Name" />
<asp:BoundField datafield="Employment" HeaderText="Employment" ItemStyle-Width="10%" ItemStyle-Wrap="false" SortExpression="TaxAgency" />
<asp:BoundField datafield="JoinedDate" HeaderText="JoinedDate" ItemStyle-Width="14%" ItemStyle-Wrap="false" SortExpression="CurrentAdvancedDate" />
<asp:BoundField datafield="DateofBirth" HeaderText="DateofBirth" ItemStyle-Width="14%" ItemStyle-Wrap="false" SortExpression="NewAdvancedDate" />
<asp:BoundField datafield="JobDescription" HeaderText="JobDescription" ItemStyle-Width="30%" ItemStyle-Wrap="true" Visible="true" SortExpression="LegalDescription" />
</Columns>
<EmptyDataTemplate><label class="label label-danger" style="font-size:13px; font-weight:600;">No records found !</label></EmptyDataTemplate>
<PagerStyle HorizontalAlign="Left" CssClass="GridPager" />
</asp:GridView>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddlcountry" EventName="SelectedindexChanged"/>
<asp:AsyncPostBackTrigger ControlID="DateTxtBox" EventName ="TextChanged"/>
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)