CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Brendan Tompkins [MVP]

Blog First. Ask Questions Later.

August 2005 - Posts

  • CodeBetter.Com is a Success, why not CycleBetter.Com?

    I’ve just been wowed by the success of CodeBetter.Com.  We’ve grown to nearly 20K unique daily visitors in just over 6 months. 

    Of course the main reason for our success is the twenty unstoppable blogging machines (UBMs) we’ve managed to amass. Really, these guys are outstanding. I’m truly humbled to be blogging with them.

    But another factor that I’m intrigued by is that we’re a focused feed.  People just seem to take to the idea that we’re not going to talk (much) about things unrelated to coding. 

    Well, I thought I’d see if I can do it again.  Are people going to get sick of the sea of non-sequitur blogs out there, and crave focused feeds in different areas?  I’m betting that they will. A couple of weeks ago I registered CycleBetter.Com.  I’ve set up community server and threw on a quick skin.  The idea is simple. Focused blogging around cycling for mountain bikers, road racers, cyclocross riders, unicyclists, whatever...

    I’ve kicked it off with the following post to a few newsgroups.  I’ll let you know how it goes! -B

    CycleBetter.Com is currently offering blog, photo sharing and forum accounts for serious cyclists looking to help create a new kind of cycling community online.

    No Politics, no Religion, just Cycling

    Requirements:  You must have a commitment to writing about topics relating to cycling.  We're not a generic blog site, and if you're looking to start a blog to talk about your cat, CycleBetter.Com is not the place for you.  There are plenty of free, general blogging places out there if you feel like the world needs another soap-box, and you have something to say.

    We're hoping to create a place for focused blogging around cycling and have a strong commitment to keeping a clean main feed.  This means that if you subscribe to the main feed of CycleBetter.Com, you will find one thing - people passionate about and writing about bikes.

    If you’re interested, visit http://www.cyclebetter.com, or http://cyclebetter.com/forums/2/ShowPost.aspx and follow the “I Want a Blog” links.

    Thanks! 

    Brendan Tompkins

    CycleBetter.Com

  • An ASP.NET Modal Panel Control

    One UI element that has always been tricky to create in ASP.NET applications is the Modal Window.  Often, applications will present an entire page for simple property editing, in situations where a modal window is a more elegant, and straight-forward UI element.  This is probably due mainly to the fact that there are no intrinsic browser controls that work well for this, and are easy to deal with on the server side.

    SDDs Are So Last Year

    A while back, I proposed a solution for creating Modal Windows, which I called Sticky Draggable Divs (SDDs)

    If you do Web Application development, you've no doubt struggled with the task of creating Modal forms.  You have different options for doing this, each with their own advantages and pitfalls.  Hosting your form in a new browser instance (window.open()) is really a kludge, and many users have popup blocking software which will break this approach. Using true Modal dialogs (window.showModalDialog()) doesn't work well from within ASP.NET. Using draggable DIV elements solves some of these issues, but has its own set of problems. Dragging DIV elements involves using DHTML and JavaScript and the script that you have to write to enable this can be tricky. Toss browsers other than IE into the mix, and you've got even more problems.

    A big problem with this approach was that it relied on DHTML Behaviors which is IE only and can cause problems with browsers running with a high security level. After living with this solution for over a year, and it’s drawbacks, I finally looked for a better way.

    A Better Solution

    I’ve come up with a new solution which uses standard ASP.NET Controls, DHTML and cross-browser JavaScript. ModalPanel is implemented as a sub-classed ASP.NET Panel control.  Since it’s a Panel, it can be programmed in a way you’re probably already familiar with if you do ASP.NET development.

    This control  adds a Title Bar, and optional close button to the Panel.  When the user drags the title bar, the entire panel is dragged.  It also uses cookies to remember it’s position on postbacks and return visits to the page.

    You can experiment with it here at my demos site.

    Implementation

    Step 1: Reference my Tompkins.Web dll in your project. 

    Download the source code here, the DLL here,  or an entire example project here.  Add a project reference to the DLL and optionally add the control to your toolbar in Visual Studio. 

    You’ll  then  want to create an instance of the control on your page of course.

     <cc1:modalpanel id="ModalPanel1" title="Your Title Here" runat="server"></cc1:modalpanel>

    Step 2: Add the CSS styles and images to your project. 

    See the style.css, toolbar_close.gif and window_titlebg.gif files in either download for examples.

    Step 3: Set Properties

    There are some properties that you can set, such as the window’s title, and you can also alter the CSS classes used to style the thing. 

    Step 4: Handle the WindowClosed Event, and show/hide the control.

    The only event to concern yourself with is the WindowClosed event.

      public event EventHandler WindowClosed;

    All your application must do is handle this event, and show/hide the control as you would with any other ASP.NET Panel…

       private void ModalPanel1_WindowClosed(object sender, System.EventArgs e)

        {

          this.ModalPanel1.Visible = false;

        }

    You’re also going to want to add some code to show the panel in the first place, like so.

        private void ButtonPlus1_Click(object sender, System.EventArgs e)

        {

          this.ModalPanel1.Visible = true;

        }

    That’s it!  If your have trouble getting it to drag properly, or if it looks all funky, make sure you have your CSS stylesheet referenced properly, and that you have the CSS classes defined as I show in my example.

    -Brendan

  • (my) PDC Contest Winner

    I know that Steve and Peter are among the many bloggers eager to find out who the winners to the Blog'n My Way to the PDC contest are...   It will no doubt be a fantastic year for the PDC. .NET and Visual Studio are really hitting their strides, and on top of it all, there's Vista (no pun intended).  Hey, maybe MS will do an Oprah thing and send everyone who entered, or give us all cars. Actually, I'd rather go to PDC. ;)

    Anyway, I wanted to announce the winner to my own contest, the one where I'm giving away a book to a blogger who uses my PDC Contest Entry Generator service.

    Well, it turns out that people actually connected to my service and submitted requests!  In fact, here's the list of bloggers who took the time to bang some code against my service... Very cool guys!  (I'd personally recommend subscribing to their feeds too)
    So, as promised, I'm giving away a copy of COM Programming with Microsoft .NET (Paperback), and the winner is.....

    Leon Langleyben!   Congrats Leon!   Please send me your address, via the contact form on this blog.

    -Brendan


More Posts