12.3. Understanding Postbacks with Web Parts

When you are working with Web Parts in ASP.NET, it is important to understand how much traffic goes back and forth across the wire. To watch the traffic directly, download Fiddler at www.fiddlertool.com and have this tool open when you build and run the page from Listing 12-1.

At first, you will notice that none of the traffic of your page is showing up in the Fiddler tool (use with IE). This is due to the fact that you are working locally using localhost. To correct this, add a period directly after the localhost (or 127.0.0.1) so that your URL is similar to the following:

http://localhost.:3405/WebSite1/Default.aspx

Obviously, the port number you are working with (mine is 3405) will be different. Once you add the period, click refresh in the browser to start seeing the traffic being monitored. Figure 12-3 provides a sample of what a recoded page in Fiddler looks like.

Now when you take any action on the page, as you would expect, these actions cause a postback and the entire page is once again returned to the browser. You will also notice that there is the dramatic page flicker going on because of the postback. This request and response is presented here in Figure 12-4 as viewed in Fiddler.

When you click the Design mode link, the page changes to allow you to move Web Parts around the page. Even changing modes causes the entire page to be reposted. When in the Design mode, you can change the order of the parts as they appear in each ...

Get Professional ASP.NET 3.5 AJAX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.