in

Utah .NET User Group

Home of Utah's professional .NET developers.

Matthew M. Osborn's Blog

December 2007 - Posts

  • Happy Holidays & My Resolution

    ztimes_square_ball Just wanted to wish every one happy holidays! One of my new years resolutions will be to post some sort of code tip at least once a week. :/ Hopefully I will be able to pull this off and provide some good code tips and tricks.  If you have any yourself and you would like to share let me know. I am always looking for more ways to seem better than other coders errrr I mean be more productive.  Well till then Happy Holidays!

  • Collapsible Panel JavaScript

    When Microsoft first released its AJAX framework codename Atlas, at the time, they also released a collection of community created controls called the AJAX Control Toolkit. This toolkit has become quite popular and highly useful, however, I found that one of the most popular controls that I was using was the collapsible panel extender. This gave the user an easy way to create a simple collapsing effect within their website. This is nice but I found I wanted to implement this effect on sites that I was not using any of the other AJAX features. So I set out to create my own library that I could import that mocked the basic functionality of the collapsible panel extender but did not have the overhead of implementing the full Microsoft AJAX framework. This is what I came up with.

    The principle is simple you have a simple html div tag that has content inside that you would like to hide or show with a collapsing effect on a given action. The easiest way to implement this is to make the function call on a click event. The way I prefer to implement this is to use two divs stacked on on top of the other.  Using the top one as the header and trigger and the bottom as the content.  Here is an example of how I set it up.

       1:  <div id="divHeader" style="cursor: pointer;" onclick="toggleDiv('divContent', 'img1')">
       2:      <img id="img1" alt="Exapnad" src="expand.gif" /> Header
       3:  </div>
       4:  <div id="divContent" style="overflow:hidden; display:none;">
       5:      Content<br />Content<br />Content<br />Content<br />
       6:  </div>

    There is one thing in this piece of html code that I haven't explained.   The image in the Header is used to display an altering graphic depending on the state of the content div.  Now that If you do not want to implement it just omit it from the method call. Now it is time to import that .js file and configure the setting.  Here is the configuration section of the .js file that you will need to change.  

       1:  //Configuration section
       2:  //********************************************************
       3:  var ExpandImageSrc = 'expand.gif'; //image location to display when Div is collapsed
       4:  var CollapseImageSrc = 'collapse.gif'; //image location to display when Div is Expanded
       5:  var speed = 15; //how often the div refreshes to the new height
       6:  var incriment = 5; //each time the div refreshes height will be increased or deceased by this amount
       7:  //********************************************************


    ExpandImageSrc & CollapseImageSrc are the locations of the images that will be alternating.  Speed is how often the animation will refresh and increment is the amount the height of the div will change.  By changing these two variables you have control over the look and feel of collapsing animation. Hopefully this will help those of you looking for a simple way to implement collapsible panel animation.

    Download the .js file here

  • Windows Live Writer

    windowsLIVE Today I had been searching for a good tool to help me compose my blog post and upload them to my blog.  Something that was a desktop client that allowed me to compose them save them and then upload them to my blog.  Something that was slightly better then the rich text editor provided by my blog engine.  After a little searching a came across windows live writer a free Microsoft tool that was designed to upload to your live journal but also has build in support for other engines.  It was very easy to set up just input your blog address and it automatically detects the settings and supported feature.  Another interesting feature is that it allows for extensibility in the form of plug-ins.  It uses the same Gallery website as the sidebar gadgets and it is all community supported.  So far I have no problems with it but I will revisit this topic after a few post and let you know how it works out. download windows live writer here.

Copyright © 2000-2007, Utah .NET User Group
Powered by Community Server (Commercial Edition), by Telligent Systems