[out of date post... this deals with MS Atlas CTP... which has been change drastically and is now MS Ajax Extensions]
I started a post yesterday (and I will complete it) about my experiences wiring up Atlas to a site that has multiple MasterPages (actually the site I’m working on is a portal that dynamically selects the MasterPage based on the URL that is used to hit the site).
I have been noted as an early critic (Ok, I made one post where I thought you had to use Web Services… I still think the docs are really messed up for leading you to believe that this is true… I’ll post about this once I’ve played with it a little more…).
So I have been playing with Atlas… Ok, I’m more than playing. I’m using it. Atlas gives me the one thing that I wanted more than anything. It’s an extremely concept, but a very hard thing to accomplish well (you can accomplish it, but the “well” part is the trick).
My goals for JAAJAX were very simple. I wanted an Ajax library that let me put more code on the server. You might say “what about the GUI widgets?” To that I say “Padowan (tm), back in the day we were DHTML widgeting all over the place. It was wonderful… that is until a new version of one of the browsers came out then we were scrambling to fix the issues… new browsers and new standards tended to screw everything up.” I know you’re saying, “but, but, but… what about the standards… if you stay standards compliant you’ll be ok…” Again, “We all thought that back in the day too… Where did that get us? Not only did the standards radically change, but browsers object models radically change (compare the DOM in NS4.7– to NS6+).” Basically, I don’t trust any of this new GUI stuff. I’m old school… I try to stick with pure HTML. Although, I’m not as bad as I’m letting on; I will be playing with some of the widgets and I will be probbaly building a few, but right now I’m taking small steps in that direction (mainly because I got burned in the past).
I love the Atlas UpdatePanel!!!!
Now that I have that out of my system. Let me explain what it is (if you are someone who has yet to look at it). I’m sure someone at CodeBetter has talked about it, but maybe not. Here’s how you use it…
First of all install Atlas. It won’t hurt your machine I promise. Also start a new Atlas project (or do like I did and start a new Atlas project so you can copy all the settings to the web.config of an existing project).
Add the following to your page (in between the form tags)…
<form id="form1" runat="server">
<atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
<atlas:UpdatePanel ID="upnlMyLabel" runat="server" Mode="Always" RenderMode="Inline">
<atlas:ControlEventTrigger ControlID="btnMyButton" EventName="Click" />
<asp:Label ID="lblMyLabel" runat="server" Text="" />
<asp:Button runat="server" CssClass="contentButton" ID="btnMyButton" Text="Click Me" OnClick="btnMyButton_Click"
So here’s what happens: when the Button is clicked page will be Atlas Postback’d (which means an Ajax call will occur back to the page firing the standard events including btnMyButton_Click and any changes to the Label will be rendered after the postback will be rendered to the page. This includes text changes as well as hiding the field (I haven’t tried it, but I bet you could change the font as well)
You also don’t need the Triggers tag (in the UpdatePanel) at all. You can simply wrap a section of server side Html that would normally cause postback (like say a dropdownlist with a SelectedIndexChanged event) and the postback will automagically happen via Ajax on browsers that support it posting the page and calling the event on the server and will update any server controls within the UpdatePanel that change
This is the kicker. If the browser doesn’t support postback what do you think happens? You can almost see this coming. The browser will still cause normal postbacks and you don’t need to do anything with it. Very cool! So for “up level browsers” they get a great experience and downlevel browser users are encouraged to upgrade <grin />
[tags: Ajax, Atlas]
| posted on Wednesday, April 26, 2006 8:56 PM