ThreadAbortException

August 2007 Entries

Web Developer Webcast Series

Here again, after a two month break I am doing a Webcast series on ASP.NET 2.0, AJAX, ASP.NET vNext & Visual Studio 2008 for Web Developers.

The registration links for the same are as below:-  Please note, you need to register for each of the webcasts separately

August 27th - 31st Everyday at 4pm

ASP.NET 2.0 Deployment Tips and Tricks

https://msevents.microsoft.com/CUI/Register.aspx?culture=en-IN&EventID=1032349234&CountryCode=IN&IsRedirect=false

AJAX Enabling your existing ASP.NET 2.0 Applications - Tips and Tricks

https://msevents.microsoft.com/CUI/Register.aspx?culture=en-IN&EventID=1032349237&CountryCode=IN&IsRedirect=false

Advanced ASP.NET AJAX

https://msevents.microsoft.com/CUI/Register.aspx?culture=en-IN&EventID=1032349239&CountryCode=IN&IsRedirect=false

ASP.NET "Futures" - A peep into what is coming up in vNext

https://msevents.microsoft.com/CUI/Register.aspx?culture=en-IN&EventID=1032349241&CountryCode=IN&IsRedirect=false

What is new in Visual Studio 2008 for Web Developers?

https://msevents.microsoft.com/CUI/Register.aspx?culture=en-IN&EventID=1032349244&CountryCode=IN&IsRedirect=false

Please note that all these sessions are conveniently placed at 4:00pm based on the inputs and the convenience to attendees.

So, what are you waiting for? Go ahead and register for the above.  Additionally, do not forget to get the Outlook Reminder added to your Microsoft Outlook so that it reminds you before the session and also provides you the Live Meeting Details etc., for your convenience.

If you feel you want a specific topic to be discussed in any of the above webcats, kindly post in the comments.

Looking forward to see you all in the Webcast.

Cheers !!!

UpdatePanel Internals - Part II - My Session at Tech Mela Contd.,

This article is in continuation with my earlier article on Update Panel Internals - TechMela Session 2 - Deep Dive: ASP.NET AJAX so you may want to check it before reading this, in case you havent read it already.

So, we left at the place where we were examining what is the HTML output when using a simple ScriptManager tag in your page, Adding an UpdatePanel, adding multiple UpdatePanels, UpdatePanels with Trigger etc.,  We were particularly drilling into the HTML Markup that is generated when adding an UpdatePanel and subsequently multiple UpdatePanels, Triggers etc., to your page, the array they get appended to, in the markup.  There is one more pending Array which might interest you, on what goes into it.  It would contain the normal Postback controls when declared as a trigger for the UpdatePanel.

When you declare an UpdatePanel with a Trigger, you can define a trigger to be either Async Postback or a normal Postback.  A normal PostBack would result in the whole page refreshing along with the Update Panel area.  Theoretically this sounds stupid since you can as well  put a normal button anywhere in the page and call the refresh.  However, there are scenarios where you would want a Trigger arising out of UpdatePanel to refresh the page and these trigger control IDs go into the third Array as seen in the following markup snippet (currently it is a blank array in this example).  The final thing '90' is the timeout which specifies when it will timeout before it can complete the async postback and here it is 90 seconds. 

Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdatePanel1','tUpdatePanel2','tUpdatePanel3'], ['Button4'], [], 90);

A word of note though is that, updateControls method is internal and it might change anytime with a next release / Service Pack so dont rely on this markup specifically.

What we originally intended was, to find out, how the UpdatePanel works :)  So lets proceed in that direction.

Like mentioned in the Part I, the Update Panel works in conjunction with the Script Manager defined in the page and calls the updateControls method which internally calls the _onFormSubmitCompleted method which is part of MicrosoftAjaxWebform.js file located in the Microsoft AJAX Library that is installed.

The sequence of Page Processing that happens for an AJAX Enabled Page is as follows:-

  • initializeRequest
  • beginRequest
  • pageLoading
  • pageLoaded
  • endRequest

All of the above are members of the PageRequestManager class which is the key class in Asynchronous postbacks.  You can imagine the PageRequestManager class as an equivalent to Page Class in a normal ASP.NET Web Page.  However, PageRequest Manager class doesnt replace the normal Page Class methods like Page_Init, Page_Load etc., The only difference in an asynchronous postback is that, the Page_Render method renders back only the modified HTML markup and it doesnt re-render the whole page as in the case of a normal ASP.NET Webform Pafe Life cycle.

So, if you want to handle an Async Postback execution and abort it, the class to take instance of is the PageRequestManager class.

We will explore more on PageRequestManager class and how to use its instance to work with the different methods in the next article.

Cheers !!!

ASP.NET AJAX Error: "Element 'ScriptManager' is not a known element. This can occur if there is a compilation error in the Web site"

While trying to AJAXify your ASP.NET 2.0 Applications, there are certain things you need to take care of, before being able to use ASP.NET AJAX Extensions in your existing pages.

One of the main things is to obviously get ASP.NET AJAX installed.  You can get ASP.NET AJAX 1.0 from here.

Secondly you need to upgrade your existing ASP.NET 2.0 Application's Web.Config file with the settings required for it to be able to understand ASP.NET AJAX.  I had written a detailed step by step procedure in my earlier article on this.

Despite doing the above when you try to add ASP.NET AJAX Server Side controls like ScriptManager, UpdatePanel etc., and run the page, you might get the error "Element 'ScriptManager' is not a known element.  This can occur if there is a compilation error in the Web Site".

You might be seeing the red squiggly line under ScriptManager and similar ASP.NET AJAX Extension controls.

The reason might be that you havent installed Visual Studio 2005 Service Pack 1.  The Visual Studio 2005 SP1 provides support for ASP.NET AJAX as well as couple of other things like Web Application Projects etc.,  You can find more about the Visual Studio 2005 SP1 features from my earlier article here.

Once you install Visual Studo 2005 SP1 you will notice that the ScriptManager and other ASP.NET AJAX Extensions are understood by Visual Studio 2005 and doesnt show up the red squiggly or any errors.

In general it is better if you follow this order in AJAX enabling your existing ASP.NET 2.0 Applications

1. Install Visual Studio 2005 SP1.  It can be installed from here.

2. Install ASP.NET AJAX

3. Install ASP.NET AJAX Control Toolkit (Optional)

4. Upgrade your existing ASP.NET 2.0 Application's Web.Config file.  Detailed steps here.

5.  Start AJAX Enabling different sections of your site based on requirements and design.

Hope this helps.

Cheers !!!