Trip in the Atlas - Part 1
The new version of the site is totally rewritten in C# and ASP.NET 2 and uses
So the new scenario I wanted to implement was a system of connected Webparts,
one showing an article, a how-to or news and the other the
comments associated with that. The connection of the webparts was done in
about 10 minutes, really cool techno.
Then I learned that an Atlas UpdatePanel can’t be part of a Webpart because
then you have the UpdatePanel in a Template of the WebpartZone and that doesn’t
work, so you have to move the UpdatePanel to have it around the Webpartzone. As
I am working with nested Master Pages I decided to have the UpdatePanel in
an asp Content control around the WebPartZone like this:
<%@ Page Language=”C#” MasterPageFile=”~/OneColumn.master” AutoEventWireup=”true”
CodeFile=”Articles.aspx.cs” Inherits=”Articles” Title=”Tech
Head Brothers - Articles” %>
<%@ MasterType VirtualPath=”~/OneColumn.master” %>
<%@ Register Assembly=”Nsquared2.Web” Namespace=”Nsquared2.Web.UI.WebControls.WebParts”
<asp:Content ID=”Content1” ContentPlaceHolderID=”ContentPlaceHolder” runat=”Server”>
ID=”panelarticles” Mode=”Conditional” runat=”server”>
<nsquared2:TemplatedWebPartZone ID=”ContentZone” runat=”server” ChromeTemplateFile=”~/Templates/Chrome/THBOriginalTemplate.chrome”
Then in my comments WebPart I implemented a button doing a
response redirect to another page that will handle the writing of a new comment,
and this in the UpdatePanel postback not the whole Page postback. To be able to
access some information from the calling page I had added some information in
the Session on the first page that I wanted to read on the second one. Boom!!
Session is empty on the second page. I then removed the UpdatePanel and session
was back again. hum!!! But that was not the scenario I wanted for my comments,
so I added again my UpdatePanel and made several tests withtout any success.
Then searching on the forum I found why, here : “The
specific reason it happens is that when ScriptManager detects a Redirect during
an async postback, it clears the response, which means all cookies are lost. One
of those cookies is the session ID cookie. This doesn’t necessarily affect all
scenarios, but it does affect some.“ A bug in the CTP april of Atlas.
Then it was clear if the Response is cleared, no chance to get my
As it was not critical data I decided to use QueryString to pass
on data and that’s for sure worked. I will revert to Session when it will be
Now I have a system with connected WebPart, one displaying
comments using Atlas UpdatePanel to reload only the comments that the suer wnats
to see. Great stuff!!
There is one thing I don’t liked in the WebPart connection is
that if you have a link button in your page and the OnCommand is set, then when
the Command is called the WebParts connection is not already done so you have to
remmeber parameters given to your method and reuse them in OnPreRender.
[ Currently Playing : With My Two Hands - Ben Harper - Diamonds
On The Inside (04:35) ]