December 2005 - Posts

I installed the new Decemeber CTP Atlas VSI today and so far I am pretty impressed. I have only done a quick sample, but it is very impressive and easy to use. In a previous post, I talked about the UpdatePanel, but I did not realize at the time how easy they have made it to use.

What the UpdatePanel does is allow you to put any kind of regular server side control (i.e.: textbox, buttons, gridviews, you name it) and it will automatically intercept those controls postback events and convert them to callbacks. This means that you do not need to have any specific knowledge of AJAX or of how callbacks work in order to dynamically update a portion of the page.

The way it works is simple. First start by turning on partial rendering by passing a value of true to the EnablePartialRendering attribute like in the example below.

<atlas:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" 
runat="server" />

Once you have registered it start by creating a new UpdatePanel. In this panel, you specify a ContentTempalate. It is in there that you can put any server side controls that you want including registering events as normal (i.e.: button click, etc.). There is also a triggers element that allows you some more customization of when to intercept postback events.

Here is an example of it in use. In this case my button click event fires the event handling method defined in the code behind that simply appends some text to the string in the textbox and writes it out to a label. All of this happens without a postback occuring.

<atlas:UpdatePanel ID="UpdatePanel1" Mode="Always" runat="server">
  <ContentTemplate>
    <asp:TextBox ID="TextBox1" runat="server" />
    <asp:Button ID="Button1" runat="server" Text="Submit" 
OnClick="Button1_Click" />
    <asp:Label ID="Label1" runat="server" />
  </ContentTemplate>
</atlas:UpdatePanel>

That is all it takes to take advantage of this in Atlas. If you are interested in downloading the Atlas CTP, you can get it at the link below.

Atlas December CTP

The web project migration wizard that is built into Visual Studio 2005 is pretty functional, but it had a few issues. If you have to upgrade any existing web projects, I highty recommend you get this update first. It fixes some problems with files getting renamed to lowercase as well as some issues regarding inherited pages and controls.

Visual Studio 2005 Updated Web Project Wizard

Another CTP of atlas is coming really soon. It looks like they have added a ton of features. First they got rid of their lame ass XML script controls and replaced them with something that is more in line with the existing server controls today.

What is cool is that they created the concept of an updatable region. This tells the page that this part of the page can be updated. You simply use the new UpdatePanel control and put in regular ASP.NET server side controls (i.e.: GridView, or whatever).

Another cool thing is that the ability to do timed refreshes of a section. So that way you can have a part of the page update automatically without posting the entire page back. Say, goodbye to sites using meta refreshes.

I checked and this is not out yet, but it should be by the end of the week or early next week I believe.

You can read more about the new features from Nikhil.

There are a number of things coming out for ASP.NET 2.0 that are very exciting.
  1. Major Update to Atlas - They are adding a ton of features.
  2. Updated Migration Utility (VS2003 -> VS2005) - Should see this early next week.
  3. Web Application Project Refresh
  4. Web Deployment Project Update - We are using this in Beta form now.  It seems to work pretty well.
  5. Profile Provider for Database Tables - This sounds cool.  It allows you to integrate existing profile data from external sources.
  6. Hosting upsize tool for SQL Express - I think this makes it easy to migrate SQL Express databases to real SQL Servers.
  7. CSS Adapters for Controls

You can read about all of this here.

Scott's Blog

As if ASP.NET Page events weren't complicated enough.  Throw master pages into it and it gets even worse.  Here is the sequence of some of the events when using a Master Page.
  1. Master page controls Init event.
  2. Content controls Init event.
  3. Master page Init event.
  4. Content page Init event.
  5. Content page Load event.
  6. Master page Load event.
  7. Content controls Load event.
  8. Content page PreRender event.
  9. Master page PreRender event.
  10. Master page controls PreRender event.
  11. Content controls PreRender event.

This is a bit complicated, but hopefully this reference will help in the future.  More info can be found here.

I posted this link a while back about design templates.  Well Microsoft has released even more.  Now there is no excuse for having an ugly looking site.  These out of the box templates are enough to get you moving in the right direction.  Check them out; the new ones are at the bottom of the page.
 
This is a new addin for Visual Studio 2005 that is supposed to make doing stuff with CSS a lot better.  Be sure and check it out.
 
I mentioned a while back that the existing SmtpMail object in System.Web had been rendered obsolete.  If you are writing some new code and wish to send mail, use System.Net.Mail instead.  This code snippet from Scott will show you how to do it.
 
It turns out one of the better features added to Visual Studio 2005 is remote debugging.  It is actually quite simple to set up.  The only caveat is that you have to be an administrator on the remote computer.  It works by using a Windows Service that runs on the remote server.  To install this service on the remote computer, simply run rdbgsetup.exe in the vs\Remote Debugger\x86 folder of the Visual Studio Installation DVD.
 
That will install a service as well as install an application that iwll let you monitor incoming debugging sessions.  If you have windows firewall enabled on either computer, you will have to allow some ports to be open.  You can find this information in the Visual Studio Help.
 
To start remote debugging, make sure that the web site that you have deployed is in debug mode.  If it is precompiled, choose the debug option, so that the pdb files are emitted when compiled.  Then, open up the solution in Visual Studio on the client machine.  Go to the Debug menu -> Attach to Process.  Type in the remote computer name and then you will see a list of processes.  Click on the w3wp.exe process to debug the ASP.NET application, set some break points, and then hit the application in your web browser.
 
Also, I discovered that you must have the Remote Debugging Monitor open on the remote machine for you to be able to attach to the process.
The web.config now supports intellisense but they changed how it worked between Beta 2 and the release.  Previously in beta 2, it was required to put a namespace specifying where to get the schema for the intellisense.  They removed this requirement, so now IntelliSense will not work if a namespace is specified.  The bad time is that the ASP.NET Web Administration tool always inserts this back in (bug).  So basically, if IntelliSense is not working, do the following.  Change:
 
 <configuration 
xmlns=" http://schemas.microsoft.com/.NetConfiguration/v2.0">
 
to:
 
<configuration>