Ajax Modal Popup没有关闭IE中的TextChange事件

时间:2014-07-25 16:27:41

标签: c# asp.net ajax events modalpopup

在我的页面中,我有一个触发的text_change事件,它会进入数据库,查找值,然后设置文本框和隐藏字段。设置这些字段后,我会显示模态弹出窗口以验证返回的值。问题是一旦显示弹出窗口,关闭按钮激活前大约需要30秒。我已经缩小到text_change事件,因为我在页面上有几个text_change事件,它们显示了一个用于验证的模式弹出窗口,我得到了所有这些事件的相同行为。当我从button_click事件触发页面上的验证摘要时,我不会得到相同的行为我不确定为什么会出现延迟以及如何解决此问题。

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/SiteMaster.master" AutoEventWireup="true"
    CodeBehind="PoReceiving.aspx.cs" Inherits="ChatWirelessWebOLPApp.PoReceiving" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
        <ContentTemplate>
            <table width="100%">
                <tr>
                    <td class="page-heading" colspan="3" style="height: 20px;">
                        PO Receiving
                        <hr style="width: 99%; margin: 5px 0 10px 5px; padding: 0; background-color: #000;" />
                    </td>
                </tr>
            </table>
            <div id="dvBody" style="width: 100%; float: left; margin: -24px 0 0 0; padding: 0;">
                <div style="width: 950px; margin: 0 auto 0 auto; font-family: Calibri; font-size: small;">
                    <div style="width: 100%; float: left; margin: 30px 0 0 0; display: block;" id="Div2">
                    </div>
                    <div style="width: 100%; float: left; margin: -25px 0 0 0; display: block;" id="dvRo">
                        <div id="dv_RmaInfo" style="width: 950px; margin: 10px auto 0 auto; border: 1px solid #ccc;">
                            <table style="width: 90%;" align="center">
                                <tr>
                                    <td colspan="2" align="center" style="height: 30px;">
                                        <asp:Label ID="lblMsg" runat="server" CssClass="ErrorMsg" />
                                    </td>
                                    <tr>
                                        <td align="right">
                                            <asp:Label ID="lblpallet" runat="server" Width="150px" Text="Pallet Nbr: " Style="margin-right: 5px;"></asp:Label>
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtPalletId" runat="server" Width="150px" />
                                            <asp:RequiredFieldValidator ID="rfvPkNbr" runat="server" Font-Bold="true" Font-Size="Medium"
                                                ErrorMessage="Pallet Nbr Required" ForeColor="#FF3300" ControlToValidate="txtPalletId"
                                                Display="Dynamic" ValidationGroup="group1">*</asp:RequiredFieldValidator>
                                            <asp:Button ID="btnSearch" runat="server" Text="Search" Width="100px" Style="width: 100px;
                                                padding: 2px 0; cursor: pointer; margin-left: 5px; background: #0071bd; border: 1px solid #ccc;
                                                color: #fff; font-family: Arial; font-size: 12px;" OnClick="btnSearch_Click" />
                                        </td>
                                    </tr>
                            </table>
                            <asp:HiddenField ID="HiddenField1" runat="server" />
                            <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="pnlPopup1"
                                TargetControlID="HiddenField1" OkControlID="btnDlgOK1" BackgroundCssClass="modalPopUp"
                                DropShadow="true">
                            </ajaxToolkit:ModalPopupExtender>
                            <asp:Panel ID="pnlPopup1" runat="server" CssClass="popUp" Width="300px">
                                <br />
                                <table align="center">
                                    <tr>
                                        <td align="center">
                                            <asp:ValidationSummary HeaderText="The following errors occurred:" ID="ValidationSummary1"
                                                ValidationGroup="group1" Font-Names="Calibri" Font-Size="Medium" Visible="true"
                                                runat="server" ForeColor="Black" align="left" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center">
                                            <asp:Label ID="lblPopUpMsg1" runat="server" Font-Names="Calibri" Font-Size="Medium"
                                                Visible="False"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center">
                                            <br />
                                            <asp:Button ID="btnDlgOK1" CssClass="button" runat="server" Style="width: 100px;
                                                padding: 2px 0; cursor: pointer; margin-left: 5px; height: 23px; background: #0071bd;
                                                border: 1px solid #ccc; color: #fff; font-family: Arial; font-size: 12px;" Text="Close" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <br />
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                        </div>
                        <%--<br />
<br />--%>
                        <asp:Panel ID="panel1" runat="server" Visible="false">
                            <br />
                            <div id="Div3" style="width: 950px; margin: 10px auto 0 auto; border: 1px solid #ccc;">
                                <table cellpadding="2" cellspacing="0">
                                    <tr>
                                        <td align="right">
                                            <asp:Label ID="Label6" runat="server" Text="Shopping Cart:" />
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtShoppingCart" runat="server" /><asp:RequiredFieldValidator ID="rfvtxtShoppingCart"
                                                runat="server" Font-Bold="true" Font-Size="Medium" ErrorMessage="Shopping Cart Required"
                                                ForeColor="#FF3300" ControlToValidate="txtShoppingCart" Display="Dynamic" ValidationGroup="group2">*</asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <asp:Label ID="Label7" runat="server" Text="Enter Ship to Code:" />
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtShipToCode" runat="server" Width="65px" AutoPostBack="true" OnTextChanged="txtShipToCode_TextChanged" /><asp:RequiredFieldValidator
                                                ID="rfvtxtShipToCode" runat="server" Font-Bold="true" Font-Size="Medium" ErrorMessage="Ship Code Required"
                                                ForeColor="#FF3300" ControlToValidate="txtShipToCode" Display="Dynamic" ValidationGroup="group2">*</asp:RequiredFieldValidator>
                                        </td>
                                        <td align="left" colspan="4">
                                            <asp:TextBox ID="txtMarket" runat="server" Enable="false" Width="250px" />
                                            <asp:HiddenField ID="hdnLocId" runat="server" />
                                            <%--<asp:DropDownList
                                                ID="ddlMarket" runat="server" Visible="false" /><asp:RequiredFieldValidator ID="rfvtxtMarket"
                                                runat="server" Font-Bold="true" Font-Size="Medium" ErrorMessage="Select a Market" InitialValue="none"
                                                ForeColor="#FF3300" ControlToValidate="ddlMarket" Display="Dynamic" ValidationGroup="group2">*</asp:RequiredFieldValidator>--%>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <asp:Label ID="Label8" runat="server" Text="Customer Part Nbr/Mfg Part Nbr:" />
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtPartNbr" runat="server" AutoPostBack="true" OnTextChanged="txtPartNbr_TextChanged" /><asp:RequiredFieldValidator
                                                ID="rfvtxtPartNbr" runat="server" Font-Bold="true" Font-Size="Medium" ErrorMessage="Part Nbr Required"
                                                ForeColor="#FF3300" ControlToValidate="txtPartNbr" Display="Dynamic" ValidationGroup="group2">*</asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" valign="top">
                                            <asp:Label ID="Label9" runat="server" Text="Mfg Part Nbr:" />
                                        </td>
                                        <td align="left" valign="top">
                                            <asp:TextBox ID="txtMfgPartNbr" runat="server" Enabled="false" />
                                        </td>
                                        <td align="right" valign="top">
                                            <asp:Label ID="label11" runat="server" Text="Serialized:" />
                                        </td>
                                        <td align="left" valign="top">
                                            <asp:TextBox ID="txtSerialized" runat="server" Enabled="false" Width="46px" />
                                        </td>
                                        <td align="right" valign="top">
                                            <asp:Label ID="label10" runat="server" Text="Part Description:" />
                                        </td>
                                        <td align="left" valign="top">
                                            <asp:TextBox ID="txtDescription" runat="server" Enabled="false" Height="51px" Width="257px"
                                                TextMode="MultiLine" />
                                        </td>
                                    </tr>
                                    <tr id="rowSerialized" runat="server" visible="false">
                                        <td align="right">
                                            <asp:Label ID="label12" runat="server" Text="TMO Asset Nbr:" />
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtAssetNbr" runat="server" /><asp:RequiredFieldValidator ID="rfvTxtAssetNbr"
                                                runat="server" Font-Bold="true" Font-Size="Medium" ErrorMessage="T-Mobile Asset Tag Required"
                                                ForeColor="#FF3300" ControlToValidate="txtAssetNbr" Display="Dynamic" ValidationGroup="group2">*</asp:RequiredFieldValidator>
                                        </td>
                                        <td align="right">
                                            <asp:Label ID="label13" runat="server" Text="Serial Nbr:" />
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtSerialNbr" runat="server" Width="102px" /><asp:RequiredFieldValidator
                                                ID="rfvTxtSerialNbr" runat="server" Font-Bold="true" Font-Size="Medium" ErrorMessage="Serial Nbr Required"
                                                ForeColor="#FF3300" ControlToValidate="txtSerialNbr" Display="Dynamic" ValidationGroup="group2">*</asp:RequiredFieldValidator>
                                        </td>
                                        <td align="right">
                                            <asp:Label ID="label17" runat="server" Text="Putaway Bin:" />
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtBin1" runat="server" />
                                        </td>
                                    </tr>
                                    <tr id="rowNonSerialized" runat="server" visible="false">
                                        <td align="right">
                                            <asp:Label ID="label14" runat="server" Text="Quantity:" />
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtQty" runat="server" ontextchanged="txtQty_TextChanged" AutoPostBack="true" /><asp:RequiredFieldValidator ID="rfvTxtQty"
                                                runat="server" Font-Bold="true" Font-Size="Medium" ErrorMessage="Quantity Required"
                                                ForeColor="#FF3300" ControlToValidate="txtQty" Display="Dynamic" ValidationGroup="group2">*</asp:RequiredFieldValidator>
                                        </td>
                                        <td align="right">
                                            <asp:Label ID="label16" runat="server" Text="Putaway Bin:" />
                                        </td>
                                        <td align="left" colspan="2">
                                            <asp:TextBox ID="txtBin2" runat="server" Width="97px" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <asp:Label ID="label15" runat="server" Text="Nbr of Labels:" />
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtNbrOfLabels" runat="server" /><asp:RequiredFieldValidator ID="rfvTxtNbrOfLabels"
                                                runat="server" Font-Bold="true" Font-Size="Medium" ErrorMessage="Number of labels to print Required"
                                                ForeColor="#FF3300" ControlToValidate="txtNbrOfLabels" Display="Dynamic" ValidationGroup="group2">*</asp:RequiredFieldValidator>
                                        </td>
                                        <td align="right">
                                            <asp:Label ID="label18" runat="server" Text="Clear Shopping Cart:" />
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="ddlCloseShoppingCart" runat="server">
                                                <asp:ListItem Selected="True" Text="NO" Value="no" />
                                                <asp:ListItem Text="YES" Value="yes" />                                                
                                            </asp:DropDownList>
                                        </td>
                                        <td align="right">
                                            <asp:Label ID="label19" runat="server" Text="Clear Pallet:" />
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="ddlClosePallet" runat="server">
                                                <asp:ListItem Selected="True" Text="NO" Value="no" />
                                                <asp:ListItem Text="YES" Value="yes" />                                                
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="6" align="center">
                                        <br />
                                            <asp:Button ID="btnSave" runat="server" Text="Save" Style="width: 100px;
                                                padding: 2px 0; cursor: pointer; margin-left: 5px; height: 23px; background: #0071bd;
                                                border: 1px solid #ccc; color: #fff; font-family: Arial; font-size: 12px;" OnClick="btnSave_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
                                                <asp:Button
                                                    ID="btnReset" Style="width: 100px; padding: 2px 0; cursor: pointer;
                                                    margin-left: 5px; height: 23px; background: #0071bd; border: 1px solid #ccc;
                                                    color: #fff; font-family: Arial; font-size: 12px;" runat="server" Text="Reset"
                                                    OnClick="btnReset_Click" />
                                        </td>
                                    </tr>
                                </table>



            <asp:HiddenField ID="HiddenField2" runat="server" />
                            <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender2" runat="server" PopupControlID="pnlPopup2"
                                TargetControlID="HiddenField2" OkControlID="btnDlgOK2" BackgroundCssClass="modalPopUp"
                                DropShadow="true">
                            </ajaxToolkit:ModalPopupExtender>
                            <asp:Panel ID="pnlPopup2" runat="server" CssClass="popUp" Width="300px">
                                <br />
                                <table align="center">
                                    <tr>
                                        <td align="center">
                                            <asp:ValidationSummary HeaderText="The following errors occurred:" ID="ValidationSummary2"
                                                ValidationGroup="group2" Font-Names="Calibri" Font-Size="Medium" Visible="true"
                                                runat="server" ForeColor="Black" align="left" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center">
                                            <asp:Label ID="lblPopUpMsg2" runat="server" Font-Names="Calibri" Font-Size="Medium"
                                                Visible="False"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center">
                                            <br />
                                            <asp:Button ID="btnDlgOK2" CssClass="button" runat="server" Style="width: 100px;
                                                padding: 2px 0; cursor: pointer; margin-left: 5px; height: 23px; background: #0071bd;
                                                border: 1px solid #ccc; color: #fff; font-family: Arial; font-size: 12px;" Text="Close" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <br />
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>


                                <asp:HiddenField ID="HiddenField3" runat="server" />
                                <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender3" runat="server" PopupControlID="pnlPopup3" TargetControlID="HiddenField3"
                                    BackgroundCssClass="modalPopUp" DropShadow="true">
                                </ajaxToolkit:ModalPopupExtender>
                                <asp:Panel ID="pnlPopup3" runat="server" CssClass="popUp" Width="300px">
                                    <br />
                                    <table align="center">
                                        <tr><td align="center">
                <asp:ValidationSummary HeaderText="Form Validation:" ID="ValidationSummary3" ValidationGroup = "group2"
                                    Font-Names="Calibri" Font-Size="Medium"  Visible="true" runat="server" ForeColor="Black" align="left"/>                                   
            </td></tr>
                                        <tr><td>
                                            <asp:Label ID="lblPopUpMsg3" runat="server" Font-Names="Calibri" Font-Size="Medium"
                                                Visible="False"></asp:Label>
                                            </td> </tr>
                                            <tr>
                                                <td align="center">
                                                    <br />
                                                    <asp:Button ID="btnDlgOK3" runat="server" CssClass="button" OnClick="btnDlgOK3_Click"
                                                        Style="width: 100px; padding: 2px 0; cursor: pointer; margin-left: 5px; height: 23px;
                                                        background: #0071bd; border: 1px solid #ccc; color: #fff; font-family: Arial;
                                                        font-size: 12px;" Text="Continue" />
                                                    &nbsp;&nbsp;&nbsp;&nbsp;
                                                    <asp:Button ID="btnDlgCancel3" runat="server" CssClass="button" OnClick="btnDlgCancel3_Click"
                                                        Style="width: 100px; padding: 2px 0; cursor: pointer; margin-left: 5px; height: 23px;
                                                        background: #0071bd; border: 1px solid #ccc; color: #fff; font-family: Arial;
                                                        font-size: 12px;" Text="Cancel" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <br />
                                                </td>
                                            </tr>
                                    </table>
                                </asp:Panel>
                                         </div>
                        </asp:Panel>
                    </div>
                </div>
            </div>
        <input type="hidden" id="printConfirm" runat="server" />
        <input type="hidden" id="printString" runat="server" />
        <input type="hidden" id="nbrLabels" runat="server" />

        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdateProgress ID="BusyIndicator" runat="server" DynamicLayout="true" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <div class="progress">
                <asp:Image ID="Image2" runat="server" ImageUrl="~/images/ajax-loader.gif" />
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</asp:Content>





  protected void txtShipToCode_TextChanged(object sender, EventArgs e)
    {
        if (txtShipToCode.Text != "" && !string.IsNullOrEmpty(txtShipToCode.Text))
        {
            PoReceivingDBHandler po = new PoReceivingDBHandler();
            DataTable location = new DataTable();
            string msg = string.Empty;

            if (!po.GetShipToLocation(txtShipToCode.Text.Trim().ToUpper(), ref location, ref msg))
            {
                ErrorLogging log = new ErrorLogging();
                log.LogError("PoReceiving.aspx.cs-txtShipToCode_TextChanged", "DB ERror", string.Empty, string.Empty, msg, HttpContext.Current.Session["LoginID"].ToString());
                ValidationSummary2.Visible = false;
                ModalPopupExtender2.Show();
                lblPopUpMsg2.Text = msg;
                lblPopUpMsg2.Visible = true;
                return;
            }
            else
            {
                if (location.Rows.Count > 0)
                {
                    txtMarket.Text = location.Rows[0]["LOC_DESC"].ToString();
                    hdnLocId.Value = location.Rows[0]["LOC_ID"].ToString();
                    //ValidationSummary2.Visible = false;
                    ModalPopupExtender2.Show();
                    lblPopUpMsg2.Text = "Please verify Market matches code entered.";
                    lblPopUpMsg2.Visible = true;
                    //return;
                }
                else
                {
                    txtMarket.Text = string.Empty;
                    //ValidationSummary2.Visible = false;
                    ModalPopupExtender2.Show();
                    lblPopUpMsg2.Text = "No market was found for the code entered.\n\rPlease check and re-enter the code.";
                    lblPopUpMsg2.Visible = true;
                }
            }
        }
    }

0 个答案:

没有答案