ASP.NET AJAX JavaScript Class Browser (take 2)

Updated on 2//22/2007:
New version available here: ASP.NET AJAX JavaScript Class Browser (take 3) 

I've read all the great feedback on the first release of the class browser and I've made some updates and fixes. First, I've added FireFox support. It should probably work in Safari and Opera now as well but I don't have those on my laptop to test. It snowed last night in the Seattle area so much of the area is closed down and we were told to work from home today. That, and my car is at the shop getting serviced, so I'm not going to work to test it out :) Second, I added support for viewing the Microsot AJAX Futures (formerly known as "Preview" or "CTP") types. To install the new class browser just overwrite the old files with the new attached ZIP.

To view the Futures types, follow these steps:

  1. Add the Futures DLL to your app's Bin directory.
  2. Open up the Master page and uncomment the ScriptReference items to the Futures scripts.

Technically this support was always in there; you can add ScriptReferences to any script libraries you have and they will automatically show up in the class browser.

Some of you may be curious about the "All Types" view. This view shows a flat list of all the types available to the class browser without the TreeView. Our test team and documentation team sometimes use this to "diff" builds of Microsoft AJAX to see what got added or removed. It's a great way for them to see if they need to add new test automation or additional documentation topics.

Published Tuesday, November 28, 2006 8:33 AM by Eilon
Filed under: , , ,

Comments

# re: ASP.NET AJAX JavaScript Class Browser (take 2)

Tuesday, November 28, 2006 1:35 PM by Michael

Just thought you'd liek to see how I extended you class browser to include the AjaxControlToolkit:

/***** Paste into ClassBrowser.master ******/

<%@ Import Namespace="AjaxControlToolkit" %>

<script runat="server">

   System.Collections.Generic.List<string> loadedAjaxControlToolkitScripts = new System.Collections.Generic.List<string>();

   string _assemblyName = "";

   protected void Page_Load(object sender, EventArgs e)

   {

       //AjaxControlToolkit

       _assemblyName = "AjaxControlToolkit";

       foreach (Type _type in System.Reflection.Assembly.Load(_assemblyName).GetTypes())

       {

           LoadRequiredScript(_type);

       }

       foreach (string resourceName in System.Reflection.Assembly.Load(_assemblyName).GetManifestResourceNames())

       {

           if (resourceName.EndsWith(".js") && !loadedAjaxControlToolkitScripts.Contains(resourceName))

           {

               loadedAjaxControlToolkitScripts.Add(resourceName);

               ScriptManager1.Scripts.Add(new ScriptReference(resourceName, _assemblyName));

           }

       }

   }

   void LoadRequiredScript(Type _type)

   {

       System.ComponentModel.AttributeCollection attrCollection = System.ComponentModel.TypeDescriptor.GetAttributes(_type);

       ClientScriptResourceAttribute _clientScriptResourceAttribute = (ClientScriptResourceAttribute)attrCollection[typeof(ClientScriptResourceAttribute)];

       RequiredScriptAttribute _requiredScriptAttribute = (RequiredScriptAttribute)attrCollection[typeof(RequiredScriptAttribute)];

       if (_requiredScriptAttribute.ExtenderType != null)

           LoadRequiredScript(_requiredScriptAttribute.ExtenderType);

       string scriptPath = _clientScriptResourceAttribute.ResourcePath;

       if (scriptPath != null && !loadedAjaxControlToolkitScripts.Contains(scriptPath))

       {

           loadedAjaxControlToolkitScripts.Add(scriptPath);

           ScriptManager1.Scripts.Add(new ScriptReference(scriptPath, _assemblyName));

       }

   }

</script>

Leave a Comment

(required) 
(required) 
(optional)
(required)