Click here to Skip to main content
15,898,035 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
See more:
I have added a modalpopup in masterpage which gets closed even if data in textboxes is not valid as per the RequiredFieldValidator. It closes even if OK / Cancel button id clicked. Alongwith modal popup, I have also added ConfirmButtonExtender. Also, I referred to ASP.NET AJAX Control Toolkit ModalPopupExtender Control in Action[^] but not getting the required.
Plz help...:confused:
I have tried all 4 solutions but not getting the desired result..
:confused:
Posted
Updated 5-Aug-11 4:35am
v3

add this to your buttons
C++
OnClientClick="JavaScript: return false;"
 
Share this answer
 
I agree with sudesh.
You need to call .show method of modal popup extender on the raised event.

Thanks
Mahesh
 
Share this answer
 
Ajax modal popup closes if any controls present on it causes a postback.

use OKControlID and CancelControlID properties of the modal popup and assign your OK and cancel button ID's for these properties respectively.

If you want to perform any operations on OK and cancel, use OnOKScript and OnCancelScript properties. the scripts can be defined as javascript functions.

If you want intentional postback from the control present on popup then, after performing your postback action add a line at the end to show the popup back again
ex: mpe.Show();
 
Share this answer
 
v3
 
Share this answer
 
Comments
Tech Code Freak 1-Aug-11 7:11am    
Third link is GREAT!!!
Thanks for that.
My 5 for the Third Link!
I'm also bookmarking your answer!
Mohammad A Rahman 1-Aug-11 7:34am    
Thanks Tech :)
Kevin Roberts 14-May-13 9:50am    
try to manually show your popup control so if you are using a button in the button_click event handler add the following ModalPopupExtender1.Show() "ModalPopupExtender1" = the name of your countrol
C#
protected void btnShowModal_Click(object sender, EventArgs e)
       {
          //this is the button that is used to invoke
          //Manually show the modal popup
            ModalPopupExtender1.Show();
        }
 
Share this answer
 
take update pannel in your form.. to avoid post back
 
Share this answer
 
if your model popup extender close any button click then we have the best solution show your popup also on that button in which you do not want close the popup it's prefect solution.

Laxman negi
 
Share this answer
 
v3
Comments
[no name] 29-Aug-13 9:54am    
The question was asked and answered 2 years ago. There is no real need to keep answering it. Especially when you did not even really provide a solution.
HI
Here is my modalpopup

When I click the button "btnOk" inside my panel, then the popup disappears.

XML
<ajaxToolkit:ModalPopupExtender ID="ModalPopupTextBoxEmpty" runat="server"
          TargetControlID="Image6"  PopupControlID="PNLTextBoxEmpty" BackgroundCssClass="modalBackground" OkControlID="btnOk"
            DropShadow="false" />
 
Share this answer
 
Comments
[no name] 29-Aug-13 9:54am    
The question was asked and answered 2 years ago. There is no real need to keep answering it.
Anele Ngqandu 29-Aug-13 10:24am    
my bad...

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