" /> " /> Learn Dash AJAX Dot Com -
Welcome to Learn Dash Ajax Dot Com

AjaxControlToolkit CascadingDropDown Issue with FireBug

Friday, March 27, 2009
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);
}
}
}

Labels: , , , , ,

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home


AddThis Feed Button   Bookmark and Share