Click here to Skip to main content
13,832,953 members
Click here to Skip to main content
Add your own
alternative version


23 bookmarked
Posted 15 Nov 2007
Licenced CPOL

Using Validation Controls on an UpdatePanel having an AJAX PopupExtender

, 15 Nov 2007
Rate this:
Please Sign up or sign in to vote.
UpdatePanel is not compatible with the ASP.NET validation controls in the current release. Here is a solution to solve the problem.


This article explains how to get around the problem of incompatible ASP.NET validation controls used on UpdatePanels in AJAX.


UpdatePanel is not compatible with the ASP.NET validation controls in the current release. This creates a problem on popup controls created using the ModalPopupExtender control of the AJAX Toolkit.

Using the code

Let's say we have a user control which is used as an AJAX modal popup dialog.

In PopupDialog.ascx, we will have the following:

<AJAX:ModalPopupExtender ID="popup" TargetControlID="LinkButton1" 

  PopupControlID="popupControlPanel" runat="server" CancelControlID="CancelButton" /> 

The CancelControlID dictates that the popup should be hidden on clicking the CancelButton. The above works fine as long as there are no validation controls on PopupContainer. However, if a validation control is present on the popup, then that gets validated on Cancel Click, but the popup still gets hidden as expected.

If the validation was successful, then there is no problem; but if it fails, then the popup doesn't show up again even by clicking the button which opened it first time. Also, none of the AJAX postbacks will work thereafter on the page till it is refreshed.

This is because the focus is still with the control where the validation failed, which is now hidden.


To make the validators compatible with an UpdatePanel control, set the EnableClientScript property of the validators to false. This disables the client script that would ordinarily be used to perform validation in the browser. As a result, during an asynchronous postback, the validators perform validation on the server. However, because only the content of the UpdatePanel is refreshed, the validators can provide the kind of immediate feedback that is ordinarily provided by a client script.


  • Posted on Nov 15th 2007.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Gyan Jadal
United States United States
Software Architect

You may also be interested in...


Comments and Discussions

GeneralNeeed source code for the same Pin
rama charan11-Dec-07 17:56
memberrama charan11-Dec-07 17:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01 | 2.8.190114.1 | Last Updated 15 Nov 2007
Article Copyright 2007 by Gyan Jadal
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid