Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using ajax modal popup that button does not fire button event

XML
<asp:TextBox runat="server" ID="txtValue" />
       <asp:Button ID="btnSubmit" Text="Submit" runat="server" OnClick="btnSubmit_Click" />
       <asp:Label ID="lblText" runat="server" />


XML
<div>
       <asp:Panel runat="server" ID="pnlDisplay">
           <div>
               <table>
                   <tr>
                       <td>
                           <asp:Label Text="Enter Correct Values" runat="server" />
                       </td>
                   </tr>
                   <tr>
                       <td>
                           <asp:Button Text="OK" ID="btnOK" runat="server"  />
                       </td>
                   </tr>
               </table>
           </div>
       </asp:Panel>
       <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="pnlDisplay"
           TargetControlID="btnSubmit" BehaviorID="btnSubmit">
       </asp:ModalPopupExtender>


C#
This event does not fire

protected void btnSubmit_Click(object sender, EventArgs e)
       {
           if (txtValue.Text != string.Empty)
           {
               ModalPopupExtender1.Hide();
               lblText.Text = txtValue.Text;
           }
           else
           {
               ModalPopupExtender1.Show();
           }
       }
Posted
Comments
Ra-one 6-Mar-12 8:30am    
try removing BehaviorID="btnSubmit"

1 solution

when target control ID event is not fired in Ajax Modal Popup
so put another control ID for Target Control ID

just for this purpose we are using lblSubmit Control

XML
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="pnlDisplay"
           TargetControlID="lblSubmit" BehaviorID="btnSubmit">
       </asp:ModalPopupExtender>
 
Share this answer
 
Comments
mlingo209 1-Aug-12 4:36am    
I'm having the same problem, so here we using the label to show the popup right? How? will the popup show on lblsubmit textchanged?

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