Published: 18 Oct 2006
By: Azhar Khan

This article provides steps to solve the "Unrecognized Tag" problem for an Atlas Control. It provides the necessary solution to solve that given problem.

Introduction

Having developed an atlas composite social security control - I wanted to change the root namespace from the default (<Project Name>) to the standard, followed at my company. I thought it would be simple enough; I was in for a big surprise. Basically I opened the project properties and replaced the Root namespace from "AmericanSSN" (this was my Project Name) to "AO.Web.UI.AtlasControls". I recompiled the project, included it in toolbox and dropped the composite control on an ASPX page, the control rendered fine at design time. When the page was loading at runtime, I got the "Unrecognized tag" error for "americanssn:AmericanSSNBehavior". Looking at the rendered HTML, I found that under the xml-script section generated by extender class, the page tag and behavior were rendered as:

Next I looked at the generated assembly using ILDASM, at very end of the MANIFEST section was the following entry to bundle the JavaScript resource into the assembly:

Since I had changed the Root namespace, I had to change the extender file so that it renders the following:

I also had to change the JavaScript file. The changes required are explained in the following three steps.

Step 1

Modifications to project properties:

Click on project properties and change the root namespace from <Project Name> to AO.Web.UI.AtlasControls.

Project Properties

Step 2

Modifications to the extender file (AmericanSSNExtender.vb):

Modify the "Assembly Resource Attribute" region, click on the + sign to open the region and change the namespace qualifier of the JavaScript file from <Project Name> to the root namespace. This is necessary because web resources must be referenced with their fully qualifed name.

Modify the ClientScriptResource class attribute tag, change the prefix parameter from <Project Name> to the root namespace, change the namespace qualifier of the JavaScript file from to root namespace. The prefix is used in constructing the xml-scrpt section.

The sections marked in Red were replaced with those marked in Blue

Project Properties

The above was changed to:

Project Properties

Step 3

Modifications to behavior file (AmericanSSNBehavior.vb):

The behavior file has the javascript code (ms-ajax class). At the start of the javascript code a namespace is registered and any reference to the behavior class needs to be qualified by the registered namespace. Change the default namespace registered <Project Name> to the root namespace and change all references to it too.

The sections marked in Red were replaced with those marked in Blue at different places in the JavaScript file.

Project Properties

The above was changed to:

Project Properties

Project Properties

The above was changed to:

Project Properties

The important thing to note in the following section is the changes to the Sys.TypeDescriptor.addType method. While changing the Extender file we had changed the prefix parameter of the ClientScriptResource class attribute. Notice that over there the namespace was small cased. That is what will get written to the HTML payload, and the Sys.TypeDescriptor.addType method will get executed when the page loads in the clients browser before the atlas framework script reads and parses the xml-script section. The atlas framework parser script is the one that throws the error "Unrecognized Tag" based on addType parameters. So this needs to changed as shown below:

Project Properties

The above was changed to:

Project Properties

Summary

This article described how to change namespace from the default namespace to a more realistic one for an Atlas Extender Control project.

<<  Previous Article Continue reading and see our next or previous articles Next Article >>

About Azhar Khan

Sorry, no bio is available

This author has published 2 articles on DotNetSlackers. View other articles or the complete profile here.

Other articles in this category


Animating a Web Form using ASP.NET AJAX
In this article you will learn how to animate a webform using asp.net ajax.
Jquery Ajax
JQuery makes communicating with the server very, very easy. JQuery uses get(), getJSON(), and post(...
jQuery in Action 2nd edition: Queuing functions for execution
This article is taken from the book jQuery in Action, second edition. This segment shows how you can...
jQuery Deferred Objects Promise Callbacks
jQuery Deferred/Promise objects untangle spaghetti-like asynchronous code.
Test120Jan
This is my custom article

You might also be interested in the following related blog posts


Ambiguous References in DefaultWsdlHelpGenerator.aspx read more
Ruminations on Multi-Tenant Data Architectures read more
Adding Default Assemblies, Namespaces and Control Prefixes in Web.Config read more
How to call controllers in external assemblies in an ASP.NET MVC application read more
WPF Presence Controls for Office Communicator 2007 read more
CruiseControl.NET Caching Old Project Locations SOLVED read more
Silverlight 2 Beta 1 Controls Available, including Source and Unit Tests read more
Squeezing the last millisecond from the page load time read more
CS Dev Guide: How to Write a Custom Chameleon Control read more
Pattern Focus: MVP, MVC, MVWatever read more
Top
 
 
 

Please login to rate or to leave a comment.

Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.