Links to ASP.NET AJAX 1.0 resources, and answers to some common questions

Below are a few links to some ASP.NET AJAX 1.0 resources, and answers to a few common questions I've seen with the ASP.NET AJAX 1.0 release:

Great Free Resource: ASP.NET AJAX PDF Cheat Sheets

Milan has updated his great ASP.NET AJAX PDF Cheat Sheets for the ASP.NET AJAX 1.0 final release. 

You can download his updated versions here.  Make sure to subscribe to his blog to receive updates as new ones come out.

Common Gotcha: Restart IIS and Flush your Browser Cache after Install

I've seen a few cases where people are seeing older versions of the ASP.NET AJAX scripts being used even after upgrading to the ASP.NET AJAX 1.0 release.  Often this manifests itself with a client-side JavaScript error about Sys.Debug not being found.  Two things to check if you encounter this:

1) Make sure you restart IIS after you install ASP.NET AJAX (you can type "iisreset" on the command-line to-do this).  If IIS already has an older version of the ASP.NET AJAX assembly loaded when the new one is installed, it will continue to use the already loaded older version until the next time the worker process is restarted.  Restarting the worker process will cause it to pick up the new one.

2) Make sure you clear your browser cache if your browser is setup to store cached files forever.  This will avoid you running into issues where your browser still has old versions of the .js files in its cache, and uses these instead of fetching the newer versions from the server.

Common Gotcha: PageMethods now require the EnablePageMethods property to be set on the <asp:scriptmanager> control

I've seen a few people run into an issue where their static AJAX Page Methods no longer seem to work when upgrading an ASP.NET AJAX RC application to the final V1 release.  The reason for this is that ASP.NET AJAX Page Methods are no longer exposed by default on a page except if you set the "EnablePageMethods" property to true on the <asp:scriptmanager> control.  For example:

<asp:scriptmanager id="s1" EnablePageMethods="true" runat="server"/>

Once you set this attribute to true, everything else will work the same.  You can learn more about how to use PageMethods in the ASP.NET AJAX 1.0 documentation here.

Common Gotcha: Validation Controls used within the <asp:updatepanel> control

I've seen several people run into an issue where their validation controls no longer work inside an <asp:updatepanel> when upgrading to the RTM release. 

In the Beta1, Beta2 and the RC versions ASP.NET AJAX provided a set of "compatibility" controls that used the <tagMapping> web.config feature within ASP.NET to replace the built-in ASP.NET validation controls with AJAX aware controls that could be used within the <asp:updatepanel> control.  This made it appear like you were using the standard ASP.NET validation controls within your site - when in reality you were using a new set of controls that added AJAX hooks.

For the final release of ASP.NET AJAX, we decided to instead release a patch for ASP.NET 2.0 that adds the AJAX-awareness features directly into the real ASP.NET 2.0 validation controls.  This ensures that the controls work in all scenarios, and is a much cleaner and more reliable solution.  Unfortunately, though, this patch slipped a few weeks - and so wasn't pushed out via Windows Update in time for the ASP.NET AJAX 1.0 launch.

As a temporary workaround until the patch is available, you can download the same compatibility validation controls we provided with the release candidate, and map the built-in ASP.NET validation controls to them using the <tagMapping> feature in your web.config file (just like in the RC release):

<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>

The validation controls will then work fine within <asp:updatepanel> controls, and behave exactly the same as with the release candidate version.  You can download these compatibility controls here.

Hope this helps,

Scott

58 Comments

  • especially the EnablePageMethods="true" was a real show stopper.

  • When will be the Path for System.web.dll available ?

    What will be patched ? I think the problem is on the ClientScript.RegisterStartupScript method, you have to call the ScriptManager.RegisterStartupScript with Atlas. How you will correct this ? Will you add a reference to the atlas assembly ? Circular reference is not allowed, isn't it ? So will you include Atlas on System.web.dll ? Or will you use Reflection for all validator ?


    Will the patch correct other bug of ASP.net 2.0 ?

    Thanks for your answers :-)

  • This is great advice. I have one problem with the new calendar control. If it pops up over a dropdown list, it initially appears behind the control (similar to the old problem with divs appearing behind dropdownlists no matter what the z-index is). Once the month is changed the first time, the control then appears above the dropdownlist as expectd. Is there a css fix for this problem? I have tried z-index to no avail.

  • Thanks for this info Scott...EnablePageMethods is pretty important!! The validation controls was a little annoying but the workaround is fine for the short term.

    Still doesn't look like you can have PageMethods defined in a usercontrol though...this would be really nice :-)

  • Great stuff, thanks.
    I'd like to share this for anyone having trouble with tagMapping; wouldn't work for me until I moved the tagMapping section inside:

  • Hi Cyril,

    The patch to enable the validation controls will update the validation controls themsevles (not registerscript).

    Eilon has a good blog post about how you can have controls dynamically check for the presense of ASP.NET AJAX and use it only if it is present here: http://weblogs.asp.net/leftslipper/archive/2006/11/13/HOWTO_3A00_-Write-controls-compatible-with-UpdatePanel-without-linking-to-the-ASP.NET-AJAX-DLL.aspx

    We'll use the same technique for the validation control update.

    Hope this helps,

    Scott

  • Hi Will,

    Send me mail (contact details available via the about link at the top of the blog) about the calendar z-order feature you are looking for. I can then loop you in with the developer of the control to help you enable what you are after.

    Thanks,

    Scott

  • Hi Anderson,

    That web part feature is one we are looking to enable in the Orcas release.

    We do, though, support using updatepanels within web-parts today, and also support cross-browser (including FireFox and Safari) drag/drop via the ASP.NET AJAX Futures CTP.

    Hope this helps,

    Scott

  • the Drag + Drop support is exactly what I'm having trouble with. This used to work, but it does not currently work. I emailed Mike Harder and he said the drag/drop feature would not be fixed until Orcas either. There seems to be some confusion about this issue.

    This is really the only feature that is missing for me, so if you have any hints that would help a lot.

  • Scott,

    When will the patch for the validation controls be up on Windows Update?

    Keep up the great work, you guys are the best!

    Ivan

  • Thanks for the information. The information on validation control was critical

  • When the Windows Update does come out with the integrated validator controls will my Web Application (that uses the temporary workaround validator controls) fail because of the redundant controls?

    If so, would taking out the tag mappings from my web.config fix the problem?

    I am just concerned that our production server might automatically get the windows update and our site will stop working.

    Thanks for your help.

    I've been very impressed with Microsoft AJAX.

  • Hi Elijah and Ivan,

    The good news is that when the validation patch comes out, it won't break your application. By default your references will still work against the old compatibility validators.

    Once the patch is installed, though, you will be able to optionally just remove the from your web.config file to use the built-in validation controls (no code changes required).

    I don't have an exact ETA for the validation patch, but I think it is coming out in the next week or two.

    Hope this helps,

    Scott

  • Scott,

    FYI on z-Index and drop down lists (also known as select elements)...

    z-Index in Internet Explorer 6 and prior is broken for owner-draw controls. For Ie 6, you have to use workarounds for owner-draw controls.

    Anyway, you need an IFrame between any owner-draw content and any DHTML content that you are trying to draw on top of it. The IFrame is (itself) owner-draw, and so it modifies the paint region appropriately. Then the content on top is drawn in z-Index order, and so everything works out.

    The catch is, this doesn't work when the owner-draw control repaints itself. For drop down list (specifically) monitoring scrollTop and forcing a repaint of the IFrame and whatever is over it is enough, but that might not be the case for other cases (for example, it wouldn't be for Media Player).

    IE 7 has this mostly fixed. It passes a bitmap in most cases. There are still some cases where it has to let the owner draw itself for performance reason.

    As a general rule, best to design pages to avoid it.

  • Hi Jason,

    We'll actually be posting a sample soon that demonstrates how to use webmethods on user controls as well as instance methods.

    I'll post a link to it once it is posted.

    Thanks,

    Scott

  • It's the Third time I'm posting this comment, but not yet visible!
    Anyway,
    I got that Sys.Debug.IsDebug is nothing or null javascript on my remote web site an I can't restart the worker process (I have no access to their IIS anyway), what can I do now for using new AJAX 1.0 release then?
    Thank Scott for your nice blog and answers.

  • How come my validation controls still work fine without doing anything special?

    I'd like to know where to look to find broken ones... the first ones I tried worked fine.

  • Jason,

    this is the code we use to render user control in web service:

    public UserControl LoadControl(string path)
    {
    UserControl uc = (UserControl)System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(path, typeof(UserControl));
    uc.InitializeAsUserControl(null);
    return uc;
    }

    public string RenderControl(Control c)
    {
    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    System.Web.UI.HtmlTextWriter writer = new System.Web.UI.HtmlTextWriter(new System.IO.StringWriter(sb));
    c.RenderControl(writer);
    return sb.ToString();
    }

  • I installed the AJAX Futures January CTP, and then tried to drag the Microsoft.Web.Preview.dll from Windows Explorer into a new tab in the Visual Studio .NET toolbox. No controls appeared in the tab. The was an error sound, but no error message anywhere that I could find.

    What should I be doing to add the CTP controls to the VS.NET toolbox?

    Thanks,
    Rafael

  • I get an error when I open up the AjaxControlToolKit solution after running the ASPAJAXExtSetup.msi installer. I get these two errors: "The application for project '\path\AjaxControlToolkit.csproj' is not installed. Make sure the application for the project type (.csproj) is installed."
    and "The application for project '\path\TemplateVSI.csproj' is not installed. Make sure the application for the project type (.csproj) is installed."

    What is the problem? I ran the installer and attempted to open the solution just as the readme file said to. Thanks in advance!

  • Hi Jeff,

    Do you have Visual Studio to Visual Web Developer Express installed? Note that you need Visual Studio to get the .csproj to work (this contains a class library of the source).

    You might also need to install the VS 2005 Web Application Project option (or install VS 2005 SP1) to enable the test project.

    Hope this helps,

    Scott

  • Hi Jason,

    The validator download is only required if you are using the validators within an updatepanel. If you are using them outside of an updatepanel, then you are all set.

    Hope this helps,

    Scott

  • I have a page that uses 15 AJAX CalendarExtender controls in a FormView EditItemTemplate mapped out over several tabs (using the AJAX TabContainer and TabPanels). The first time the page is loaded, it loads in about 9 seconds. Subsequent page loads are taking up to 35 seconds. When I comment out the CalenderExtender controls, the page loads in 4 seconds every time.

    It makes sense for the page to take 5 seconds longer for the 15 calendar controls, but what doesn't make sense is that the next time the page is loaded it takes even longer and seems to progressively get worse.

    Any ideas?

    Thanks,
    Susan

  • I posted a comment yesterday detailing a performance issue I was having with the AJAX Calendar control. &nbsp;I realized this morning this was caused by the debug flag being set to true. &nbsp;
    I&#39;m aware the debug setting impacts performance, but I guess I&#39;m surprised at the way it seemed to be impacting the performance of the calendar control. &nbsp;Performance gradually getting worse rather than consistently slower.
    Anyway, this is no longer an issue.
    Thanks,
    Susan

  • Hello Scott!

    How is it possible to customized generated code from Scriptmanager to set it up to work with different WebForm than the default one per page?

    I'm using multiple webforms/page in different modes as POST/GET/POST and i need to customize it to set this option programatically.
    Now it seems hardcode in Ajax. Is it true?

    Regards.

  • Still having issues with AJAX RTM. In the RTM I'm getting a client-side "is undefined: 'debug'" error message. In digging through the RC javascripts in ScriptResource.axd, PreviewScript.js (I think) defined a debug (window.debug = new Sys.Debug) variable that now in the RTM is Sys.Debug = new Sys.Debug. Any help would be appreciated.

  • Hi Scott,

    I seem to be having an issue with the display of a formview in design mode when the formview is inside an update panel. I'm using VS2005 Team Edition for Developers with SP1 installed.

    The formview is meant to use 100% of the width and displays correctly when I run the app. However, when in design mode the formview is squashed into about 30% of the available width making it difficult to visualise the look of the page without actually running it. This squashing occurs irrespective of whether one of the formview templates is being edited. If I comment out the update panel the formview uses 100% of the width again.

    Do you have any clues as to why this is happening?

    Thanks

    Neil

  • Hi Lex,

    Chris did a great post on the Sys.Debug is undefined issue here: http://weblogs.asp.net/chrisri/archive/2007/02/02/demystifying-sys-is-undefined.aspx

    Can you take a look at this and let me know if it fixes your problem?

    Thanks,

    Scott

  • Hi Neil,

    Could you send me an email with details about this error? I will then loop someone in from the team to help figure out what the problem is.

    Thanks,

    Scott

  • now,the page showing the error of "Sys is not defined"
    plz help to solved it.

  • Hi Lex,

    I've faced the same issues while migrating to RTM version. I restarted IIS of my machine and that solved the issue of Sys undefined. You can try it and see if it works for you also.


  • Hi, I try to run AJAX Control Toolkit Examples but when I clicked into page that it use a ajax control I have an javascrit error, Sys.Debug is null o not an object. I try to repair this issue restaring the IIS and clear de cache in my browser , but I can't to solve this problem. What can I do? Helpme please!!
    Thanks!

  • Hi Diana,

    Typically this error means that you don't have the final V1.0 version of the ASP.NET AJAX Extensions installed on your machine, or have an older version of the AJAX Control Toolkit that doesn't work with ASP.NET AJAX 1.0.

    Can you double check that you have the final V1.0 version of ASP.NET AJAX installed?

    Thanks,

    Scott

  • Scott, What's the status of the Windows Update patch? It's been a couple weeks and I'm contemplating just adding the compatibility scripts to my project in order to move to 1.0. Thanks in advance,

    Mark

  • Hi Scott,
    How to enable drag/drop cross browser functionality for webparts other than IE. It is working fine in IE but not in Firefox and may be not in Opera. I have downloaded Ajax Futures CTP. How to proceed with it? Some people say to use ATLAS. I think AJAX is latest version of ATLAS?

  • Hello Scott,
    I am using Update panel with multiview in my page and Validation summary in my Master page. All client-side validators are working fine. And for the pages without UpdatePanel both validations server-side as well as client side are working fine and getting validation summary messages. But in a page with Update Panel when I am trying to show a validation summary on any server validation (=false) then validation summary is set to show message (i checked its assigning all the values required to show summary) but it not showing the message. Server side validation is working fine but problem is the validation summary is not shown to user.
    Let me know if I forget some thing.

    Please reply me what to do?


    Thanks in advance

    Harit Gohel

  • Scott, can you post a timeframe when the windows Update Patch will be available.
    Thanks,

  • Hi Ann,

    Unfortunately the patch has been pushed out several weeks. Right now we think it is about 6 weeks away. In the meantime I'd recommend using the validator download to get the same functionality.

    Note that this workaround will not break when the patch comes out - so you don't need to worry about having the app stop working.

    Hope this helps,

    Scott

  • Hi Harit,

    Can you send me an email with more details of the problem you are seeing, and ideally a simple .zip file showing the error? I can then have someone help you with this.

    Thanks,

    Scott

  • Hi Rahul,

    To enable drag/drop of webparts with non-IE browsers, you need to download the ASP.NET AJAX Futures CTP on http://ajax.asp.net. It will enable drag/drop support for Safari and FireFox for sure (although I'm not 100% sure of Opera).

    Thanks,

    Scott

  • Make sure microsoft must take care before release like this type of issues Validation Controls used within the control

  • Hi Scott

    I'm having trouble with the ajaxToolkit:CalendarExtender not displaying correctly when it is being loaded via an UpdatePanel using UpdateMode="Conditional".

    Basically, I don't think the calendar's StyleSheet is loading correctly, unless the calendarExtender sits outside the UpdatePanel on the initial Page Load.

    Do you know of any fix for this?

    Currently I am using a work around that involves including a hidden TextBox and Calendar Extender outside the UpdatePanel to get it to work. (Not a very elegant solution...)

    Thanks

  • Am I the only person that has problems with a form using both the ConfirmButtonExtender and a ValidatorCalloutExtender? The Validator and Confirm happen at the same time when the submit button is pressed. I would assume the confirmation should be displayed first and once the user has confirmed they want to submit, then the validation would occur. Am I missing something obvious to correct this issue or will these validation control updates correct my issue?

  • Hi scott,
    Good post regarding the validator controls issue. A question - since the namespace for the core ajax dll changed from Microsoft.web.extensions to system.web.extensions this has lead to making changes to the web.config file including the above validators changes. Is there any reason why we cant just stick with microsoft.web.extensions until everything thing is ironed out since microost.web.extensions works fine. Or are there performance issue and other things that make it a good idea to switch to the latest release. Since the pathc is 6 weeks out thereabouts why not just stick w/ the microsoft.web.ext?

  • I found a bug in it!
    Compare validation still not work correctly sometimes

  • Hi Scott -

    I followed the instructions on adding the
    1) validation tagMapping in web.config
    2) referencing the Validator.dll

    Still the validation not working as expected.
    I have a GridView and some other usercontrols (textbox and DropDownlist, and Add button) in a updatepanel, which have .net rangeValidator, requiredValidator etc..

    On post all the validation work as expected, I saw the required, range error messages displayed when I try to add item into the GridView by clicking the Add button.

    However, when I clicked the Add(button) again on the same page, somehow, the postback mess up the validation. The required, range error messages no longer displaying, however I do notice it is still performing the validation just not error messages is displaying.

    Any ideas? Thanks in advance.



  • My question - I'm new to programming in.net... i have written a asp.net program. and what i wwant to accomplish is to initizalize some lalabels on the screen when the user prints ththe screen from the brower. In code how cacan i determine if the user has prprinted? Any help is appreciate! Thanks

  • Hi Chris,

    I haven't heard of this issue before - but if you send me an email about it I can loop you in with the Control toolkit team to help.

    Thanks,

    Scott

  • Hi Ashok,

    There is no performance benefit to changing the namespace - so if you want to use the old namespace (and it is working fine) then that works too.

    Thanks,

    Scott

  • Hi Rodnec,

    Can you send me an email with this question in it? I will then loop you in with someone on the AJAX team to help.

    Thanks,

    Scott

  • When will the patch for the validation controls be up on Windows Update?

  • Hi tom,

    Unfortunately the patch got pushed out a few weeks. I believe it is now scheduled for early April. The download above provides the same functionality - so as a workaround I'd just use that right now.

    Thanks,

    Scott

  • did all the steps. i was using a required field validator for a listbox inside the updatepanel...still getting the same results even with the dll/tagmapping. validation fires but the page never submits even if the listbox has items. does it matter if the control being validated is a listbox?

  • Hi Scott,
    Can you tell me if the ASP .net 2.0 validation patch is officially available? If so, can you post a link to it please.

    Thanks so much,
    Javid

    BTW, your blog is very helpful and saves a lot of time for newbie ASP developers like me.

  • Hi Javid,

    Unfortunately the patch got pushed out a few weeks. I believe it is now scheduled for early April. The download above provides the same functionality - so as a workaround I'd just use that right now.

    Thanks,

    Scott

  • Scott,

    Thanks for the helpful post. The link to Validators.zip on Matt's page is broken and I can't post a comment ("New Comments to this post are disabled"). Do you know of another way to get the alternative controls?

    Bob


  • The link to the workaround zip file doesn't appear to work anymore. Anyone have an alternate url?

  • Hi Marc/Bill - the url to the Validators.zip file seems to be working for me right now.

    Just in case, I downloaded it and saved it on my web-site. You can now also download it here: http://www.scottgu.com/blogposts/AJAXUpdate/Validators.zip

    Hope this helps,

    Scott

Comments have been disabled for this content.