Click here to Skip to main content
15,893,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

C#
<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


C#
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
Posted
Comments
pradiprenushe 1-Aug-12 6:00am    
Are pressing enter key? Please post some more code with panel also.
mlingo209 1-Aug-12 6:06am    
Yes I am pressing the enter key for my textchanged method.
pradiprenushe 1-Aug-12 8:01am    
Dont press enter. Just enter text in textbox & press tab button & look behavior what is happening?
mlingo209 2-Aug-12 5:54am    
now the problem I'm having is that the popup does not dissappear on click of cancel button or ok button but gets docked on the form as per design, though it does popup when I click my targetControl

1 solution

here's The panel code

C#
<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>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900