Learn Dash Ajax Dot Com

Confessions of a web developer

AjaxControlToolkit CascadingDropDown Issue with FireBug

clock March 27, 2009 19:07 by author nickyt

Well I found a debugging issue today trying to implement something with the AjaxControlToolkit's CascadingDropDown control.

A page I was working on had four CascadingDropDown controls on it and even though on the server side, they were disabled, i.e. .Enabled = false, when rendered on the client, they would be disabled for one second than become readable. It had to do with populating the picklist with the web service call.

So I was trying to use the picklist.CascadingDropDownBehavior.add_populated method to add a function that disabled things after the dynamic data was populated. In Internet Explorer, no issues. In FireFox, FireBug was launching the debugger sometimes but then my add_populated method was never firing. I was going nuts.

In a last ditch effort I said, maybe I'll just disable FireBug as the clients will most likely not have it installed. I restarted FireFox with FireBug disabled and all was good. I must say that wasn't obvious. The issue I describe occurs with FireBug 1.3.3. Maybe it's only this version, I don't know. Just thought I'd mention it in case someone else ends up pulling their hair out because of this.

And for code's sake, here's what I did to disable the CascadingDropDown on the client-side:

function pageLoad(sender, args) {
    DisablePickLists();
}

// Note: If you need to debug this in FireFox, FireBug doesn't really work. I 
tried and I was able to debug below intermittently
function DisablePickLists() {
    // picklistClientIDs is populated in FormAppointmentBase.cs
    if ("undefined" !== typeof(picklistClientIDs)) {
        var populated = function(sender, args) {
            var picklist = sender._element;

            // I don't check for the existence of the picklist because it has to exist. The 
            element IDs being returned are from server-side
            // code that got the clientIDs of server controls.

            var myInterval;

            myInterval = setInterval(function() {
                if (sender._isupdating) {
                    return;
                }

                clearInterval(myInterval);
                picklist.disabled = true;
            }, 20);
        };

        for (var index=0;index < picklistClientIDs.length;index++) {
            var currentID = picklistClientIDs[index];
            var picklist = $get(currentID);
            picklist.CascadingDropDownBehavior.add_populated(populated);
        }
    }
}


Pretty Print for FogBugz Greasemonkey Script

clock March 12, 2009 17:33 by author nickyt
Well, we use FogBugz at work for logging cases and for a wiki. I needed to print some stuff the other day and didn't like it showing the header and footer of FogBugz, so I wrote a GreaseMonkey script to remove them. Check out the script on userscripts.org here.

This is a firt version of this script, so one thing you need to do is have this script disabled until you go to the page you want to print. Once you're on that page, enable the script and refresh the page. Print it then disable the script and refresh the page to get your header and footer back. I'll add a button to turn it on and off soon, but for now, it is what it is.


Google's Tip Jar

clock March 6, 2009 14:09 by author nickyt
I heard about this neat little app called Tip Jar from Google via my codeproject.com newsletter. It's a neat little app that allows anyone to submit useful tips to help us all during this gloomy recession period. Here's the original article, http://www.webpronews.com/topnews/2009/03/05/google-offers-money-saving-tips-with-tip-jar and here's my first tip, http://moderator.appspot.com/#8/e=3cfc .