KhD
KhD

Reputation: 453

Unrecognized tag prefix or device filter (Visual Studio 2010)

I am trying my hands on Visual Studio 2010 (Asp.Net 4.0) for the first time. I want to use Ajax controls, mainly ComboBox control.

I followed the step-by-step procedure mentioned in this link to download and install AjavControlToolkit.

I also followed this link for steps to add ComboBox to my webpage.

But no matter what I do, there is a green line under the control and I'm getting the error "Unrecognized tag prefix or device filter 'ajax'".

My web.config file looks like this:

         <configuration>
       <system.web>
    <pages>
        <controls>
            <add tagPrefix="ajax" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit"/>
            <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
            <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        </controls>
    </pages>
    <compilation debug="true" targetFramework="4.0">
        <assemblies>
            <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
  </system.web>
    </configuration>

The aspx page looks like this:

     <form id="form1" runat="server">
       <div>
        <asp:ScriptManager ID="sm" runat="server"></asp:ScriptManager>
        <ajax:ComboBox runat="server" AutoCompleteMode="SuggestAppend">
          <asp:ListItem>ddd</asp:ListItem>
          <asp:ListItem>fff</asp:ListItem>
          <asp:ListItem>gggg</asp:ListItem>
          <asp:ListItem>hhhhh</asp:ListItem>
        </ajax:ComboBox>    
       </div>
    </form>

I have even tried deleting the schema files from C:\Documents and Settings\xxx\Application Data\Microsoft\VisualStudio\10.0\ReflectedSchemas location.

Please help me in successfully implementing the Combobox control. Thanks!

Edited:

As a different approach, I created a new website and installed the latest version of AjaxControlToolkit using NuGet. I rebuilt the solution. I still could not see the Ajax controls in intellisense. Is there anything else that needs to be done to implement it? Please help!!

Upvotes: 4

Views: 15016

Answers (5)

Salman Siddiqui
Salman Siddiqui

Reputation: 374

Old thread but new answer :)

Ran into identical problem. The problem was extra lines copied into Web.Config by mistake. This caused the Configuration Section to become invalid.

Fixed the lines and asp tags are once gain recognised by intellisense.

Upvotes: 0

user2394508
user2394508

Reputation: 1

In my case I got this error after adding the page using the Telerik Add Scheduler Scenario. I resolved it by adding the following line to the aspx file, immediately under the <% Page ...> line -

<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

Upvotes: 0

MoarDonuts
MoarDonuts

Reputation: 756

Although the time seems to have passed for this, I had a similar problem which, after a bit of 'common sense' thought was resolved and it might help someone else.

Problems like this are often caused by something on the page not loading correctly, controls and the like, or with errors in format. Anything that prevents the IDE parsing the page correctly.

In my case, the page with the problematic control had a master page. The master page had a problem with resolving a web instance for some reason. The master page header (i.e. the 'Master' tag at the top of the page) was underlined with an error relating to not being able to match the site to a particular IIS metabase key (i.e. LM/W3SVC/12 or whatever).

Although I don't know why this happened (seemed to happen after stopping a debug session using IIS Express) switching the solution to 'Visual Studio Development Server' (i.e. cassini) and relaunching the site resolved the master page reference, and therefore the page with the problem could load the master page correctly and the problems relating to unrecognised tags went away.

So check any errors on the page itself in the <%@ %> tags at the top of the page, and also check 'up level' with master pages.

Upvotes: 2

Mitul
Mitul

Reputation: 9854

If you are using Visual Studio 2010 then I recommend downloading AJAXControlToolkit from Nuget a shown in this post (link).

I yesterday stumbled at the same problem and what worked was changing the prefix to "ajaxToolkit" and doing same thing for script manager as Stephen Walter is showing in this post (link). Please use ToolScriptManager instead of ScriptManager.

<ajaxToolkit:ToolScriptManager id="id12" runat="server"/>

Upvotes: 3

Filburt
Filburt

Reputation: 18082

Your <ajax:ComboBox /> seems to be missing the ID attribute.

...
<ajax:ComboBox ID="MyComboBox" runat="server" AutoCompleteMode="SuggestAppend">
...

To force registering the ajax tag prefix you could add it to your page

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>

If the problem persist you'll need to check if the according assembly is available.

Upvotes: 0

Related Questions