Click here to Skip to main content
16,018,525 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a modal popup extender that just works like a message box.

The process is as follows:

1. I input username and password in login textboxes
2. I press Login button.
3. When the password is about to expire, this modal popup appears stating "Your password will expire soon. Do you want to change it now?"
4. Step 3 causes postback and the password in Step 1 gets deleted.
5. I answer Step 3 by clicking on Yes and the password validator for Step 1 highlights since the password cannot be left empty.

I would like to avoid this scenario. I just want the Modal popup to load leaving the parent page as is!

I followed the simple guide of creating the dummybutton to attach to the extender. The referenced panel is also in an update panel. modal.show() is being called when password is due (conditional).

What else has to be present please? If I attach the extender to the login button it shows up as intended but immediately and the code behind doesn't execute. I just want a way that works without having to play with the visibility.

Thanks a million for your valuable help.
Justin
Posted

1 solution

Hi,

In your question i see two parts,

1. the validator for password shows error message whenever postback happens from modal popup.
Ans. Give Validation group to the login button.
Specifying Validation Groups[^]

2. You have given Target Control of modal popup to login button, because of this, the popup is opening even if the valid password.

Ans. remove target control of modal popup from login button. let the login button fire the server side event, and if you find that, password is expiring then show the modal popup from server side with hidden target control ID.

check below links to show modal popup from server side with hidden target control id:-
Modal Popup Extender server side Show()[^]
ASP.NET AJAX Control Toolkit: Show a ModalPopup and then do PostBack[^]

hope it helps
 
Share this answer
 
Comments
Jukatzu 20-Feb-13 6:30am    
Thanks for your reply Karthik. Maybe I have not explained well my problem. The modal popup extender already uses a dummy button that is hidden. I want to prevent the postback at all costs though! I just want the extender to pop up as if it has been called from a button click.
Karthik Harve 20-Feb-13 6:35am    
ofcourse, on click of the login button, you will validate the password, if you found that expiring, show the modal popup from code behind.
Jukatzu 20-Feb-13 6:38am    
Yes I did that and exactly before the modalpopup shows, the page refreshes and the modal pops up! That is my problem. I want the modal popup to show pop up withouth any page refresh whatsoever. Thanks for your assistance
Karthik Harve 20-Feb-13 6:43am    
i guess, that is fine to open modal popup after post back. since you are validating password from code behind, and if found expiring, then asking the confirmation.
Jukatzu 20-Feb-13 6:45am    
leave the password out Karthik. The password validation is not the issue here. The issue is that I don't want a postback just before modal.show()

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