Validators on AJAX updatepanel not working on IIS

I've been looking for hours to find a solution for this problem. Well first of all defining what the problem exaclty is and then finding a solution.

The Problem:

I've an dynamic loaded usercontrol(ascx) with textboxes and rangevalidators and requiredFieldValidators on an Ajax UpdatePanel.
I was developing and of course running the site in my VS.NET 2005 Cassini web server.
On a post-back the in the update panel my validators were not working anymore on my IIS (Win2k3). On my Cassini everyhting was fine.
I was using the latest AjaxToolkit for ASP.NET 2.0, thought there was a fix in it, but not.

The Solution:

I found the solution on the site of Matt Gibbs: http://blogs.msdn.com/mattgi/archive/2007/01/23/asp-net-ajax-validators.aspx

From previous experience (post that were deleted after linking them) I post the solution also here (All credits goes to Matt):

ASP.NET AJAX provides new APIs for registering script with the ScriptManager.  Using these APIs allows controls to work well with partial rendering.  Without them, controls placed inside an UpdatePanel won't work as expected. In previous CTP releases of ASP.NET AJAX, we had a set of validator controls that derived from the v2.0 controls and used the new APIs. This made them work well with ASP.NET AJAX. WindowsUpdate will soon include a version of System.Web that can take advantage of the new APIs.  So the new controls which would have been redundant have been removed.  However, the update isn't available yet and ASP.NET AJAX has been released.  So, in the short-term, the source code for a set of custom validator controls that work with partial rendering is available here.

The .zip file includes a solution and .csproj file as well as the compiled DLL.  Just put the DLL in the /bin directory of your application and include the following <tagMapping section in the pages section of the web.config.

      <tagMapping>
        <add tagType="System.Web.UI.WebControls.CompareValidator"           mappedTagType="Sample.Web.UI.Compatibility.CompareValidator, Validators, Version=1.0.0.0"/>
        <add tagType="System.Web.UI.WebControls.CustomValidator"            mappedTagType="Sample.Web.UI.Compatibility.CustomValidator, Validators, Version=1.0.0.0"/>
        <add tagType="System.Web.UI.WebControls.RangeValidator"             mappedTagType="Sample.Web.UI.Compatibility.RangeValidator, Validators, Version=1.0.0.0"/>
        <add tagType="System.Web.UI.WebControls.RegularExpressionValidator" mappedTagType="Sample.Web.UI.Compatibility.RegularExpressionValidator, Validators, Version=1.0.0.0"/>
        <add tagType="System.Web.UI.WebControls.RequiredFieldValidator"     mappedTagType="Sample.Web.UI.Compatibility.RequiredFieldValidator, Validators, Version=1.0.0.0"/>
        <add tagType="System.Web.UI.WebControls.ValidationSummary"          mappedTagType="Sample.Web.UI.Compatibility.ValidationSummary, Validators, Version=1.0.0.0"/>
      </tagMapping>

As you can see Matt is mentioning SOON, his post was from 27/01/2007. And as i know now it's still not working. :-)

Maybe somebody else has a solution or I'm I using a wrong or rather old version of Ajax (extensions) you think?

TIP: Never or ever use the Cassini in development. Use IIS.
Also, an IIS 6.0 has different behaviour on a Windows XP and on a Windows 2003 server. So if you develop and test on your IIS 6 on XP also try it on a Win2k3 IIS 6.0 if you plan to deploy it on such a server.

- Wesley

Attachment: Validators.zip
Published Wednesday, June 04, 2008 4:41 AM by wesleyw
Filed under: , , ,

Comments

# re: Validators on AJAX updatepanel not working on IIS

Friday, September 19, 2008 2:19 AM by Rajeev Jamwal

It really Works Try it

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above:
Powered by Community Server (Non-Commercial Edition), by Telligent Systems