Atlas (RSS)

Scott Stanfield's AJAX/Atlas Demo

Vertigo's CEO, Scott Stanfield, just posted the source code for his beginner-level presentation on ASP.NET AJAX ("Atlas") given at the SoCal Technical Summit.  Scott has an uncanny ability to use a technology and explain it in a very understanding, easy to follow manner.  He took a unique approach of explaining ASP.NET AJAX by first showing how to do it directly with the XMLHttpRequest object.  He then shows the same functionality with ASP.NET AJAX and expands on that. He created the code live in his presentation last Saturday! 

You can catch Scott in his upcoming session at the Silicon Valley Code Camp.

posted by AlanL with 0 Comments

ASP.NET "Atlas" becomes ASP.NET AJAX, new header logo

It seems like the name change announced by ScottGu earlier this month is starting to populate.  The official Microsoft ASP.NET 2.0 AJAX Extensions site now states ASP.NET AJAX in a clean aero-like logo header instead of ASP.NET "Atlas".  The name change can also be seen on the ASP.NET AJAX Control Toolkit site.  I will update my ASP.NET AJAX resource list when/if the underlying URLS are changed.

posted by AlanL with 0 Comments

MS ASP.NET 2.0 AJAX Extensions (aka Atlas) Resources

I've been using Atlas for a few months now and have collected a number of resources.  I just want to share the list that I've compiled so far. 

Atlas References

I have a live feed in Firefox for quick access to these resources.

Atlas Blogs

Atlas related blogs in my feed reader.

Atlas Articles

Other Atlas Resources List

posted by AlanL with 5 Comments

Yellow Fade Technique with Atlas

After seeing the new animation capabilities in the Atlas Control Toolkit, I wanted to experiment with implementing the Yellow Fade Technique.  I can't believe how simple it is with the new UpdatePanelAnimationExtender.

Demo: http://atlas.vertigosoftware.com/atlasyellowfade/

Source: http://blogs.Vertigosoftware.com/files/alan/atlasyellowfade.zip

The Code

The code should be really straight-forward.  I have an Update panel which contains an ASP.NET Label.  The update panel is triggered by the submit button which will change the label text to say hello to whatever's in the Textbox control.  I also added a server timestamp to the label.

To apply the yellow fade technique, I wrap the update panel around a div container and add the UpdatePanelAnimationExtender with properties to enable animation when the update panel has been updated.  There are two animation configured to fire in parallel for 2 seconds.  The first changes the background color from a shade of yellow back to white.  The second animation fades the content of the updatecontainer.

The work is done in this piece of code.  No knowledge of javascript necessary*!


<
atlasToolkit:UpdatePanelAnimationExtender ID="upae" runat="server">
    <atlasToolkit:UpdatePanelAnimationProperties TargetControlID="UpdatePanel1">
        <Animations>
            <OnUpdated>
                <Sequence>
                    <Parallel duration="2" Fps="30">
                          <Color AnimationTarget="updatecontainer" StartValue="#FFEF3F" EndValue="#FFFFFF" Property="style" PropertyKey="backgroundColor" />
                          <FadeIn AnimationTarget="updatecontainer" minimumOpacity=".2" />
                    </Parallel>
                </Sequence>
            </OnUpdated>
        </Animations>
    </atlasToolkit:UpdatePanelAnimationProperties>
</
atlasToolkit:UpdatePanelAnimationExtender>

* The design time support for the UpdateAnimationExtender shows the animation as simply "(Text)", so you would need to know the syntax for animations to configure it.

posted by AlanL with 12 Comments

Atlas Control Toolkit - September?

I haven't seen an official announcement from the team yet, but it looks like a new release (marked 060914) of the Atlas Control Toolkit is up on the project's site at CodePlex.  From the description, the toolkit features four new controls: Animation, NoBot, Slider, and UpdatePanel Animation.  I linked the new controls to their corresponding pages on the Atlas Control Toolkit sample page.  It doesn't look like the new name change to "ASP.NET AJAX Control Toolkit" has populated to this release of the toolkit yet.

UpdatePanel Animation

I think the UpdatePanel Animation is a necessity.  Since the browser no longer flicker between refreshes with asynchronous callbacks, more clues with animation are needed to catch the user eye when something is being updated.  It looks like we can now easily create the Yellow Fade Technique in Atlas.

AnimationExtender

The animations found in the animation extender are also nice touch.  I need to check to see if it can do the cinematic effects like Rico.

Slider Control

I've been following the slider control when it was on Garbin's blog.  One problem I'm having this control, is getting it to trigger an UpdatePanel when the ValueChanged event is fired.  I'm have a similar problem with the Rating control Rated event.  Maybe someone has an easy way to wire up a javascript event handler to these events to get it to trigger UpdatePanels?

NoBot

Nobot is a contorl to prevent bot spam by identifying bots through 4 different criteria without requiring CAPTCHA.  I need to looke more into how this control works.


Check out these new controls and the existing controls in the toolkit.  Some really excellent stuff!

Update:  I missed this earlier, but there's some really good stuff in the animation department.  Check out the new documentation on "Using Animation".  Try the quick demos within that page.  Also there's an accompanying Animation Reference.
posted by AlanL with 1 Comments

Atlas TabStrip with Asynchronous Callback

I've been thinking about how to dynamically load the contents for different panes from the previous Tabstrip example.  I accomplished this using the UpdatePanel with the Asp.net Multiview control.  You can check the end result in the demo below.  If time permits and after working out the kinks, I'll post the source here.

Demo: http://atlas.vertigosoftware.com/atlastabstrip2/tabstrip.aspx
Source: http://blogs.vertigosoftware.com/files/alan/atlastabstrip2.aspx

Update:  I added the source after some minor code cleanup and tweaks.  There is still more work to make it better.  Some ideas include adding nice effects when or after  the update panel is updated, only reload the tab panes if they haven't been loaded yet, apply better styling and css.  Let me know if you run into any issues.




posted by AlanL with 8 Comments

Atlas TabStrip

I found this gem on Bertrand Le Roy's blog and it's exactly what I needed to replace the IE TabStrip control from ASP.NET 1.1.  The original author posted the code sample on the ASP.Net Forums.  One issue with the post is that there is no working demo of this great code sample or downloadable source as echoed in the comments. I took the liberty to create quick demo and provide the source as a file-system based Atlas web project.  All credit for the code goes to Kwang Suh and Bertrand Le Roy.

The sample code eloquently uses div tags, ul tag, and css.  It works in both IE and Firefox. In addition, the javascript code is encapsulated within a single .js file and reference with the Atlas ScriptManager. 

Check it out for yourself.  Below is a demo that represents the output of the Kwang Suh's code without any edits.  You can download the source or just take a look at the individual files as text.

Demo: http://atlas.vertigosoftware.com/atlastabstrip/

Source: http://blogs.vertigosoftware.com/files/alan/atlastabstrip.zip
Default.aspx: http://atlas.vertigosoftware.com/atlastabstrip/default.aspx
TabSet.js: http://atlas.vertigosoftware.com/atlastabstrip/TabSet.js

Update: I've created a different version of the TabStrip that will perform asynchronous postback with the update panel.

Posted using the new Windows Live Writer.

posted by AlanL with 10 Comments

Atlas: Building Collapsible Panels with Atlas

The CollapsiblePanelExpander, as the name implies, allows us to easily add collapase and expand functionality to any section on the sites that we build with Atlas.  Here is a quick look at some of the different ways that we can build collapsible panels using this robust extender.  You can check out the five quick demos and the accompanying source code.  I've also made the website project available.

The code should be really self-explanatory, so there's no indepth explanation like my previous posts on Atlas.

Demo: http://atlas.vertigosoftware.com/atlascollapsiblepanel/
Source: http://atlas.vertigosoftware.com/atlascollapsiblepanel/default.aspx.txt
Download: http://blogs.vertigosoftware.com/files/alan/atlascollapsiblepanel.zip

P.S.  The demo link is down. so I posted a mirror of the demo here: http://alanle.com/atlas/atlascollapsiblepanel/default.aspx

posted by AlanL with 1 Comments

Atlas: Using the DragOverlayExtender with the ASP.NET Profile Service

My last two posts on Atlas has been well received. I plan to continue writing quick demos as I explore more about the Atlas Framework.

Today, I've been looking into the DragOverlayExtender to see how it works with the ASP.NET Profile Service. I've came up with the following example in my exploration. The demo is a simple draggable puzzle that will remember the puzzle piece location so that you can go back to it at a later time. In this post, I will share how I built it using ATLAS and the DragOverlayExtender.

You can check out the demo in the link below. It should work in both IE and Firefox. I'm still learning about Atlas, so if you have any suggestions, pointers or corrections, please feel free to add comments to my post.

Demo: http://atlas.vertigosoftware.com/atlasdragoverlay/dragoverlayextender.aspx
Source: http://blogs.vertigosoftware.com/files/alan/atlasdragoverlay.zip

Screenshot:

Web.config
In order for the the Atlas Framework to retrieve and modify the profile properties I need to first enable the profile service in web.config. To find more information about working with Profiles in Atlas, please see the Using the "Atlas" Profile service documentation.

Since I did not add a ProfileProvider, the default SQL Express provider will be used. The corresponding ASPNETDB database, which contains the tables for aspnet_profile and other ASPNET services, will automatically be created and added to the App_Data folder when I build and run the app. If you want to use a different Profile Provider, you can check out this msdn reference article: http://msdn2.microsoft.com/en-us/library/ms164644.aspx.

I did not plan to add membership and login so I enabled anonymous identification. Now ASPNET will save the profiles even for anonymous/unathenticated users that visit my demo site.

Then, I add the profile properties for the drag location for each of the puzzle pieces.

Finally, I associate the accessors for the profile properties with the profile service.

<configSections>
  <
sectionGroup name="microsoft.web" type="Microsoft.Web.Configuration.MicrosoftWebSectionGroup">
    <
section name="converters" type="Microsoft.Web.Configuration.ConvertersSection" requirePermission="false" />
    <
section name="webServices" type="Microsoft.Web.Configuration.WebServicesSection" requirePermission="false" />
    <
section name="authenticationService" type="Microsoft.Web.Configuration.AuthenticationServiceSection" requirePermission="false" />
    <
section name="profileService" type="Microsoft.Web.Configuration.ProfileServiceSection" requirePermission="false" />
  </
sectionGroup>
</
configSections>

...

<microsoft.web>
  <
anonymousIdentification enabled="true"/>
  <
profile>
    <
properties>
      <
add name="DragLocation1" allowAnonymous="true" type="String"   />
      <
add name="DragLocation2" allowAnonymous="true" type="String"   />
      <
add name="DragLocation3" allowAnonymous="true" type="String"   />
      <
add name="DragLocation4" allowAnonymous="true" type="String"   />
      <
add name="DragLocation5" allowAnonymous="true" type="String"   />
      <
add name="DragLocation6" allowAnonymous="true" type="String"   />
      <
add name="DragLocation7" allowAnonymous="true" type="String"   />
      <
add name="DragLocation8" allowAnonymous="true" type="String"   />
      <
add name="DragLocation9" allowAnonymous="true" type="String"   />
      <
add name="DragLocation10" allowAnonymous="true" type="String"   />
      <
add name="DragLocation11" allowAnonymous="true" type="String"   />
      <
add name="DragLocation12" allowAnonymous="true" type="String"   />
    </
properties>
  </
profile>

...

<profileService enabled="true"
                
setProperties="DragLocation1;DragLocation2;DragLocation3;DragLocation4;DragLocation5;DragLocation6;DragLocation7;DragLocation8;DragLocation9;DragLocation10;DragLocation11;DragLocation12"
                
getProperties="DragLocation1;DragLocation2;DragLocation3;DragLocation4;DragLocation5;DragLocation6;DragLocation7;DragLocation8;DragLocation9;DragLocation10;DragLocation11;DragLocation12" />

ASPX Code
For the puzzle pieces, I took a picture taken at Vertigo, chopped it into 12 equal chunks, and placed them on the page with the standard <img> tags. The images need to be set runat="server" so that I can reference the images in the dragoverlayProperties for the TargetControlID property.

<img src="images/213z.png" runat="server" id="Img1" alt="puzzle piece" />
<img src="images/3243.png" runat="server" id="Img2" alt="puzzle piece" />
<img src="images/879h.png" runat="server" id="Img3" alt="puzzle piece" />
<img src="images/asdf.png" runat="server" id="Img4" alt="puzzle piece" />
<img src="images/berx.png" runat="server" id="Img5" alt="puzzle piece" />
<img src="images/d4dq.png" runat="server" id="Img6" alt="puzzle piece" />
<img src="images/g3xb.png" runat="server" id="Img7" alt="puzzle piece" />
<img src="images/hhjy.png" runat="server" id="Img8" alt="puzzle piece" />
<img src="images/nyui.png" runat="server" id="Img9" alt="puzzle piece" />
<img src="images/yuij.png" runat="server" id="Img10" alt="puzzle piece" />
<img src="images/zxc5.png" runat="server" id="Img11" alt="puzzle piece" />
<img src="images/zxcv.png" runat="server" id="Img12" alt="puzzle piece" />

To expose the ASP.NET Profile Service that I've enabled in web.config to the web client, I added the Atlas ProfileScriptService. AutoSave is set to true which will automatically save the drag location is changed.

<atlas:ProfileScriptService ID="profile" runat="server" AutoSave="true">
</atlas:ProfileScriptService>
<atlas:DragOverlayExtender ID="DragOverlayExtender1" runat="server">
    <atlas:DragOverlayProperties Enabled="true" TargetControlID="Img1" ProfileProperty="DragLocation1" />
    <atlas:DragOverlayProperties Enabled="true" TargetControlID="Img2" ProfileProperty="DragLocation2" />
    <atlas:DragOverlayProperties Enabled="true" TargetControlID="Img3" ProfileProperty="DragLocation3" />
    <atlas:DragOverlayProperties Enabled="true" TargetControlID="Img4" ProfileProperty="DragLocation4" />
    <atlas:DragOverlayProperties Enabled="true" TargetControlID="Img5" ProfileProperty="DragLocation5" />
    <atlas:DragOverlayProperties Enabled="true" TargetControlID="Img6" ProfileProperty="DragLocation6" />
    <atlas:DragOverlayProperties Enabled="true" TargetControlID="Img7" ProfileProperty="DragLocation7" />
    <atlas:DragOverlayProperties Enabled="true" TargetControlID="Img8" ProfileProperty="DragLocation8" />
    <atlas:DragOverlayProperties Enabled="true" TargetControlID="Img9" ProfileProperty="DragLocation9" />
    <atlas:DragOverlayProperties Enabled="true" TargetControlID="Img10" ProfileProperty="DragLocation10" />
    <atlas:DragOverlayProperties Enabled="true" TargetControlID="Img11" ProfileProperty="DragLocation11" />
    <atlas:DragOverlayProperties Enabled="true" TargetControlID="Img12" ProfileProperty="DragLocation12" />
</atlas:DragOverlayExtender>

Javascript
I wrote a javascript scramble function to make it easy to scramble the puzzle pieces. It uses a helper randomize function to distribute the puzzle pieces. Since I named my image controls as Img1, Img2, etc... I can easily just iterate through the pieces and set the x and y positions. The function call is set on the onclick even of my scramble button.

    <script language="javascript" type="text/javascript">
    function scramble() {
        
var totalPieces = 12;
        
var pieczeSize = 125;
        
for (i=1; i<=totalPieces; i++) {
            x = randomize(document.documentElement.clientHeight - pieczeSize);
            y = randomize(document.documentElement.clientWidth - pieczeSize);

            img = $(
'Img'+ i);
            img.style.top = x +
'px';
            img.style.left = y +
'px';
        }
    }

    
function randomize(max) {
        rnd = Math.random();
        
return rnd * max;
    }
    
</script>

Styles
The styles are not really necessary for this demo. I only included it for the guide box to place the puzzle pieces in.

<style type="text/css">
#puzzlebox
{
height: 331px;
width:500px;
border: solid 1px #000;
padding: 1px;
text-align: center;
position: absolute;
left: 100px;
top: 100px;
color: gray;
}
</style>

Known Issues
  • The puzzle pieces will return to their original positions if they are dragged outside of the browser body area.
  • After being scrambled, the puzzle pieces will returned to their saved profile locations if the page is refreshed.

posted by AlanL with 2 Comments

Atlas: Creating Better Looking Checkboxes with the ToggleButtonExtender

With the ToggleButtonExtender from the Atlas Control Toolkit, you can easily create nice looking checkboxes. The ToggleButtonExtender styles ASP.NET Checkbox controls with images. In this post, I'll show you how easy it is to create the following styled checkboxes.

You can see it in action here:

You can try it here:
http://atlas.vertigosoftware.com/AtlasToggleButton/ToggleButton.aspx

ASPX Code
The aspx code contains four ASP.NET Checkboxes and the ToggleButtonExtender. The ToggleButtonExtender contains three properties to configure the image replacement for the three corresponding checkboxes.

<atlas:ScriptManager ID="ScriptManager1" runat="server" />
<div class="togglebutton">
    <asp:CheckBox ID="CheckBox1" runat="server" Text="Default ASP.NET Checkbox" /><br /><br />
    <asp:CheckBox ID="CheckBox2" runat="server" Text="Improved Checkbox with the ToggleButtonExtender" /><br />
    <asp:CheckBox ID="CheckBox3" runat="server" Checked="true" Text="Can extend multiple checkboxes" /><br />
    <asp:CheckBox ID="CheckBox4" runat="server" Text="Any icon can be used" />
</div>
<atlastoolkit:ToggleButtonExtender ID="ToggleButtonExtender1" runat="server">
    <atlastoolkit:ToggleButtonProperties TargetControlID="CheckBox2" CheckedImageUrl="images/checked.png"
        UncheckedImageUrl="images/unchecked.png" ImageHeight="16" ImageWidth="16" />
    <atlastoolkit:ToggleButtonProperties TargetControlID="CheckBox3" CheckedImageUrl="images/checked.png"
        UncheckedImageUrl="images/unchecked.png" ImageHeight="16" ImageWidth="16" />
    <atlastoolkit:ToggleButtonProperties TargetControlID="CheckBox4" CheckedImageUrl="images/ToggleButton_Checked.gif"
        UncheckedImageUrl="images/ToggleButton_Unchecked.gif" ImageHeight="19" ImageWidth="19" />
</atlastoolkit:ToggleButtonExtender>

Design Time Support
One of the neat things about the extender model is that Visual Studio will recognize that there is a checkbox extender on the page and will expose the ToggleButtonextender's properties to any of the ASP.NET Checkboxes.

ASPX Code-Behind
There is no code-behind as no logic is necessary on the server.

Styles
Here is the corresponding styles for my toggle butons, mostly to control spacing.

<style type="text/css">
body {
font:normal 10pt/13pt Arial, Verdana, Helvetica, sans-serif;
color:#666;
margin:20px;
}
.togglebutton {
padding-top:13px;
}
.togglebutton label {
padding-left:8px;
}
</style>

Source Code

You can download the source to this demo at:

Source: http://blogs.vertigosoftware.com/files/alan/atlastogglebutton.zip

posted by AlanL with 8 Comments

Atlas: Creating a Confirmation Using the ModalPopup Extender

I've been looking into Atlas Framework recently, specifically around the idea of how to apply it to future projects. Today I want to show how to use the Modal Popup Extender found in the Atlas Control Toolkit to create a modal confirmation box.

Although, there is a ConfirmButton Extender that uses the built-in javascript confirm function, I find this type of confirmation really limiting. There is no way to customize the look and feel of the popup. The popup window size is constrained which limits the text you can write in your message. You can only have "Okay" and "Cancel" text for the buttons, when in most cases the action requested is of a "Yes\NO' type.

For my confirmation, I want the following features:

  • Has to be modal
  • Fully customizable with css
  • Has to have "Yes" and "No" buttons
  • Postback if the user clicks "Yes"
  • No postback if the user clicks "No"
  • Provide feedback to the user of the action taken.

ASPX Code
The code on the ModalConfirm.aspx page is fairly straightforward. I have a Panel control which will be my popup box. It contains the popup text, the Yes button, and the No button. I'm using the ModalPopupProperties on the ModalPopupExtender to configure the confirmation box. The Delete button will trigger the confirmation and the Yes/No buttons will dismiss it. When the user clicks "Yes", a javascript function called onYes will be called, and likewise when the user clicks "No".

Notice the settings for the various class attributes. This provides the flexibility to use css to style the confirmation box. Also notice the Style="display: none" attribute to hide the confirmation until the user clicks on the delete button.

<asp:Panel ID="ConfirmtionPanel" runat="server" CssClass="modalPopup" Style="display: none">
    <div class="modalPopup-text">
        Are you sure you want to delete this item?<br />
        <br />
        <asp:Button ID="YesButton" runat="server" Text="Yes" OnClick="YesButton_Click" />&nbsp;&nbsp;
        <asp:Button ID="NoButton" runat="server" Text="No" />
    </div>
</
asp:Panel>
<
atlastoolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server">
    <atlastoolkit:ModalPopupProperties TargetControlID="DeleteButton" PopupControlID="ConfirmtionPanel"
        OkControlID="YesButton" OnOkScript="onYes()" CancelControlID="NoButton" OnCancelScript="onNo()"
        BackgroundCssClass="modalBackground" />
</
atlastoolkit:ModalPopupExtender>

ASPX Code-Behind
In the code-behind, I need to expose the asp.net client-side __doPostBack function in the Page_Load event so that I can programmatically call it from javascript later using Atlas client scripting. I also have the event handler for my YesButton_Click event which will perform the deletion by calling a middle tier object to delete the item. As a last step, I inform the user that the deletion has been performed.

    protected void Page_Load(object sender, EventArgs e)
    {
        
// Expose the __doPostBack function to programmatically call it from javascript
        Page.ClientScript.GetPostBackEventReference(this, String.Empty);
    }

    
protected void YesButton_Click(object sender, EventArgs e)
    {
        
// Code to delete the item goes here...

        Label1.Text = "Item deleted";
    }

Javascript
I have a script block in my header. The block has the two functions that has been mentioned earlier. The onYes function creates a PostBackAction object with the target control set to the YesButton. The performAction method will call __doPostBack. The onNo function simply sets the label text.

<script type="text/javascript">
    function onYes() {
        
var postBack = new Sys.WebForms.PostBackAction();
            postBack.set_target(
'YesButton');
            postBack.set_eventArgument(
'');
            
            postBack.performAction();
    }
    
    
function onNo() {
        
//no postback necessary
        $('Label1').innerText = 'Action canceled';
    }
</script>

Modal Confirmation Styles
Here is the corresponding styles for my confirmation box.

<style type="text/css">
body {
font:normal 10pt/13pt Arial, Verdana, Helvetica, sans-serif;
color:#666;
margin:20px;
}
    
/*Modal Popup*/
.modalBackground {
background-color:#000;
filter:alpha(opacity=80);
opacity:0.8;
}
.modalPopup img {
border:solid 5px #fff;
}
.modalPopup-text {
display:block;
color:#000;
background-color:#fff;
text-align:center;
border:solid 2px #000;
padding:10px;
}
.modalPopup-text input {
width:75px;
}    
.feedback
{
color: #00cc00;
font-weight: 700;
}
</style>

End Result

You can try it here:
http://atlas.vertigosoftware.com/atlasmodalconfirm/modalconfirm.aspx

Source Code

I have created a zip file with the source code to this sample. In order to run this sample, you will need:

Source: http://blogs.vertigosoftware.com/files/alan/atlasmodalconfirm.zip
posted by AlanL with 17 Comments