出现ModalPopupControl,而无需单击targetControl [英] ModalPopupControl appears without me clicking on targetControl

查看:72
本文介绍了出现ModalPopupControl,而无需单击targetControl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在弹出窗口时遇到麻烦,它似乎出现在我在表单上执行的任何活动中,我有一个文本框,该文本框使用textchanged事件来检索并在弹出面板上显示数据,但是该弹出窗口应该仅在我单击一个按钮,但是当我在文本框中更改文本时似乎出现了

Hi
I''m having trouble with my popup it seems to appear on any activity I do on the form, i have a textbox that uses the textchanged event to retrieve and show data on the popup panel but the popup is suppose to appear only when I click on a button but it seems to appear when I change text on the textbox

<asp:TextBox ID="txtProdId" runat="server" 
    ontextchanged="txtProdId_TextChanged" ></asp:TextBox>
<asp:AutoCompleteExtender ID="txtProdId_AutoCompleteExtender" runat="server"      completioninterval="10" enablecaching="true" inimumprefixlength="1" DelimiterCharacters="" Enabled="True" servicemethod="GetProductIDlist" ServicePath="~/WebService1.asmx" TargetControlID="txtProdId">
</asp:AutoCompleteExtender>


 <asp:Button ID="btnAddQProd" runat="server" BorderStyle="Outset" 
   Font-Bold="True" Text="Add Product" />
 <asp:ModalPopupExtender ID="btnAddQProd_ModalPopupExtender" runat="server" 
   DynamicServicePath="" Enabled="True" TargetControlID="btnAddQProd" PopupControlID="Panel1"
   DropShadow="true" OkControlID="btnAdd" OnOkScript="btnAdd_Click" CancelControlID="btnCancel"
   BackgroundCssClass="modalBackground">
 </asp:ModalPopupExtender>




这是文本框事件,它使用适当的值填充弹出面板中的控件





and this is the textbox event that populates the controls in the popup panel with appropriate values


protected void txtProdId_TextChanged(object sender, EventArgs e)
       {
           BusinessLogicLayer.Product objex = new BusinessLogicLayer.Product();
           objex.propProdId = txtProdId.Text;
           BusinessLogicLayer.Product P = objex.GetProduct();
           this.txtProdId.Text = P.propProdId;
           this.txtProdDesc.Text = P.propProdDesc;
           this.txtFinish.Text = Convert.ToString(P.propFinishPrice);
           this.txtPrice.Text = Convert.ToString(P.propUnitPrice);
           this.txtQty.Text = Convert.ToString(P.propQty);
           this.lblProdIDmod.Text = P.propProdId;

       }




预先谢谢你
此致




Thank u in advance
Regards

推荐答案

此处是面板代码

here''s The panel code

<asp:updatepanel id="UpdatePanel2" runat="server" updatemode="Conditional" xmlns:asp="#unknown">
                    <contenttemplate>
                        <asp:panel id="Panel1" runat="server" backcolor="Silver" cssclass="panel">
                            BorderStyle="Outset">
                            <table style="width: 100%">
                                <tr>
                                    <td colspan="2">
                                        <asp:panel id="TitleBar" runat="server" cssclass="modalPopupTitleBar">
                                            <div style="text-align: center">
                                                <td colspan="2" style="text-align: center">
                                                    Add Product</td>
                                            </div>
                                        </asp:panel>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 155px">
                                        Product ID:</td>
                                    <td>
                                        <asp:label id="lblProdIDmod" runat="server"></asp:label>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 155px">
                                         </td>
                                    <td>
                                         </td>
                                </tr>
                                <tr>
                                    <td style="width: 155px">
                                        Product Description:</td>
                                    <td>
                                        <asp:textbox id="txtProdDesc" runat="server" height="45px" width="173px"></asp:textbox>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 155px; height: 26px;">
                                        Quantity:</td>
                                    <td style="height: 26px">
                                        <asp:textbox id="txtQty" runat="server"></asp:textbox>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 155px">
                                        Finish:</td>
                                    <td>
                                        <asp:textbox id="txtFinish" runat="server"></asp:textbox>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 155px; height: 26px">
                                        Price:</td>
                                    <td style="height: 26px">
                                        <asp:textbox id="txtPrice" runat="server"></asp:textbox>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 155px">
                                        <asp:button id="btnAdd" runat="server" backcolor="White" borderstyle="Outset">
                                            Font-Bold="True" onclick="btnAdd_Click" Text="Save" Width="74px" />
                                    </asp:button></td>
                                    <td>
                                        <asp:button id="btnCancel" runat="server" backcolor="White">
                                            BorderStyle="Outset" Font-Bold="True" Text="Cancel" Width="74px" />
                                    </asp:button></td>
                                </tr>
                            </table>
                        </asp:panel>
                    </contenttemplate>
                </asp:updatepanel>


这篇关于出现ModalPopupControl,而无需单击targetControl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆