Hi, i created a ajax modal popup with some text controls and validation controls on it programmatically and attached this to be shown on click event of hyperlink. The modaI popup is working. I enable client validation on validation controls. When i submit the modal popup, validation is taking place on the client side, but the modal popup is closing instead of displaying the validation messages. Any help is appreciated.
Regards
Subba
Not sure which Validation controls you're using but you may want to check out the validator controls that are part of the System.Web.UI.Compatibility namespace (separate assembly that you need to download).
We were having a problem when using the default validation controls on an Ajax page, that despite the validation failing on the client side the page still went back to the server. We had to change the validators...check out the two links below.
http://weblogs.asp.net/scottgu/archive/2007/01/25/links-to-asp-net-ajax-1-0-resources-and-answers-to-some-common-questions.aspx
http://blogs.msdn.com/mattgi/archive/2007/01/23/asp-net-ajax-validators.aspx
Regards,
Tim
Tim, I installed the hot fix 'KB934839' and i donno whether this hot fix solved the validation control - ajax issue or not. By the way, i'm using validation summary and required field validator on my modal popup.
Sorry.. wrong post for your reply... I installed the hot fixhttp://support.microsoft.com/?kbid=933383. Let me give a try for your solution. Thanks.
Tim, i did go throughhttp://blogs.msdn.com/mattgi/archive/2007/01/23/asp-net-ajax-validators.aspx and referenced validators.dll, modified web.config. but no luck.. stil the modal popup is not shown with the requried field validators error message. i need to click on the hyperlink to show the modal popup again with those validation messages..
Hi,
That's because the close function is implemented with javascript, and the failure of validators won't prevent it from happenning.
You may try this:
1. Don't specify a button as the OK button for the ModalPopup
2. Add a click event for that button to close the popup
function closePopup()
{
var result =ValidatorOnSubmit();
if (result == true) // only close it when validation successes
{
var modalPopup = $find('ModalPopupExtender1');
modalPopup.hide();
}
}
Hope this helps.
Raymond, modalPopup is null in the page script and is erroring out..
The sample code I provided is used to express the idea of how to implement it. It may not work directly.
You may need to modify it accordingly.
No comments:
Post a Comment