Answered by:
ajax ModalPopupExtender issue in ASP.NET C#

Question
-
User1193679271 posted
hi all
iam using asp.net C# with ajax ModalPopupExtender (visual studio 2012)
i am created a ajax modal popup dialog. name: popupNewUser
with five textboxes and two buttons.
textboxes
1, txtusername.tex
2, txtpassword.tex
3, txtconfirmpassword.text
4, txtemail.text
5, txtconfirmemail.text
buttons
1, btnSave
2, btnCancel
when i click the btnCancel. close the popupNewUser dialog it's ok
my problem is when i click the btnSave. popupNewUser dialog is closing too. why?.
how to stop this.
when i click the btnSave don't close the dialog.
i want to check username and email is exist or not.
finally insert the data to datatabase.
then close the dialog.
how can I do?
give code snippet..!
best regards
DigiNaz
Saturday, June 13, 2015 6:19 PM
Answers
-
User61956409 posted
Hi Diginaz,
Thanks for your post.
how to stop this.
when i click the btnSave don't close the dialog.
Please refer to the following sample.
<div> <asp:Button ID="btnopen" runat="server" Text="ShowDialog" /> <asp:ModalPopupExtender ID="popupNewUser" runat="server" TargetControlID="btnopen" PopupControlID="Panel1" CancelControlID="btnCancel"></asp:ModalPopupExtender> <asp:Panel ID="Panel1" runat="server"> <table> <tr> <td>username</td> <td> <asp:TextBox ID="txtusername" runat="server"></asp:TextBox></td> </tr> <tr> <td>password</td> <td> <asp:TextBox ID="txtpassword" runat="server"></asp:TextBox></td> </tr> <tr> <td>confirmpassword</td> <td> <asp:TextBox ID="txtconfirmpassword" runat="server"></asp:TextBox></td> </tr> <tr> <td>email</td> <td> <asp:TextBox ID="txtemail" runat="server"></asp:TextBox></td> </tr> <tr> <td>confirmemail</td> <td> <asp:TextBox ID="txtconfirmemail" runat="server"></asp:TextBox></td> </tr> <tr> <td> <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" /></td> <td> <asp:Button ID="btnCancel" runat="server" Text="Cancel" /></td> </tr> </table> </asp:Panel> </div>
protected void btnSave_Click(object sender, EventArgs e) { //your code to save user input //open the ModalPopupExtender via show() method popupNewUser.Show(); }
Best Regards,
Fei Han
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Sunday, June 14, 2015 10:35 PM
All replies
-
User61956409 posted
Hi Diginaz,
Thanks for your post.
how to stop this.
when i click the btnSave don't close the dialog.
Please refer to the following sample.
<div> <asp:Button ID="btnopen" runat="server" Text="ShowDialog" /> <asp:ModalPopupExtender ID="popupNewUser" runat="server" TargetControlID="btnopen" PopupControlID="Panel1" CancelControlID="btnCancel"></asp:ModalPopupExtender> <asp:Panel ID="Panel1" runat="server"> <table> <tr> <td>username</td> <td> <asp:TextBox ID="txtusername" runat="server"></asp:TextBox></td> </tr> <tr> <td>password</td> <td> <asp:TextBox ID="txtpassword" runat="server"></asp:TextBox></td> </tr> <tr> <td>confirmpassword</td> <td> <asp:TextBox ID="txtconfirmpassword" runat="server"></asp:TextBox></td> </tr> <tr> <td>email</td> <td> <asp:TextBox ID="txtemail" runat="server"></asp:TextBox></td> </tr> <tr> <td>confirmemail</td> <td> <asp:TextBox ID="txtconfirmemail" runat="server"></asp:TextBox></td> </tr> <tr> <td> <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" /></td> <td> <asp:Button ID="btnCancel" runat="server" Text="Cancel" /></td> </tr> </table> </asp:Panel> </div>
protected void btnSave_Click(object sender, EventArgs e) { //your code to save user input //open the ModalPopupExtender via show() method popupNewUser.Show(); }
Best Regards,
Fei Han
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Sunday, June 14, 2015 10:35 PM -
User177399542 posted
Hi Diginaz
You need to reopen your Ajax control toolkit modal popup extender after every post back.
protected void btnSave_Click(object sender, EventArgs e) { popupNewUser.Show(); }
Tuesday, June 16, 2015 6:17 AM