After some struggles, I finally got the Web Parts function to work properly. When I created the sample page consisting of Web parts in the Vista environment last time, I could never display this page.
This is because the Web Part function allows the individual user to change the layout or appearance of the page according to his preference, so that it requires Personalization. ASP.Net 2.0, by default, works with Microsoft SQL Server Express Edition for personalization. Visual Studio 2005 places the ASPNETDB table file from Express Edition within the applications's App_Data folder automatically. Although this would be very convenient for the new developer using VS 2005 (Express Edition is freely downloadable), it presented a big probelm to me when I tried to transfer my development environment from ASP.Net 1.1/VS2003/SQL 2000 to ASP.Net 2.0/ VS2005/SQL 2005. I stumbled when I tried to load the plain vanila page with WebPartManager. The page failed to load, reporting the Database error, after trying to load SQL Express for a while as instructed by machine.config. It took me sometime to find out the way from another book, how to direct the page to SQL 2005 by coding in web.config.
Although I learned the basics how to do it from another book, it goes without saying that I had to rewrite the lines of code many times before I finnaly got the Plain vanilla WebPartManagement page to load. Now that I loaded the page containing Web Parts, I was surprised to see on top of every server control inserted in the template areas, ”Untitled 1”,“Untitled 2...in consecutive numbers. This was the result of deleting the "title=xxxx" parts found in the sample page from the ASP.Net 2.0 Book, as VS 2005 complained and marked them as errors. I revived these title insertions ignoring the error warnings and I could display the correct titles.
Also, I was quite impressed with the sample code from the Book, which inserts into the DropDown List control, the available page modes by using the “for each (…in WebPartManager1.SupportedDisplayModes)” syntax. The only trouble with this approach is that VS 2005 C# will not compile this code, display an error. Therefore, I had to manually add the four display modes of Browse, Design, Edit and Catalog, using "asp:ListItem" declarations. This approach worked OK, except that, when the modes other than “Browse” was chosen without signing in, the system displays an ugly error sign. As a solution, I had to add the lines to hide the DropDown List control when the user is anonymous.