Visual Studio 2013 - Unrecognized Namespace in Markup - asp.net

My VS2013 (using .NET 4.5) shows the weird error
Unrecognized tag prefix or device filter 'web'.
on every Control of my page.
Here's how my web.config looks like:
<pages controlRenderingCompatibilityVersion="4.0">
<controls>
<add tagPrefix="web" namespace="Customer.PL.App.Code" assembly="Customer.PL.App"/>
<add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI"/>
<add tagPrefix="company" namespace="company.Telerik.Web.UI" assembly="company.Telerik.Web"/>
<add tagPrefix="web" src="~/Code/UC/GridButtons.ascx" tagName="GridButtons"/>
<add tagPrefix="web" src="~/Code/UC/REchteList.ascx" tagName="RechteList"/>
<!-- Wizard User Controls -->
<add tagPrefix="web" src="~/OM/UC/Auftragspositionen.ascx" tagName="UCAuftragspositionen"/>
<add tagPrefix="web" src="~/OM/UC/Auftragsdaten.ascx" tagName="UCAuftragsdaten"/>
<add tagPrefix="web" src="~/OM/UC/Lieferadresse.ascx" tagName="UCLieferadresse"/>
<add tagPrefix="web" src="~/OM/UC/Vorschau.ascx" tagName="UCVorschau"/>
</controls>
</pages>
I tried removing the other Prefixes but it doesn't fix it.
It makes my intellisense crash and evertime I type
<web:
it autocompletes as
<asp:ProxyWebPartManager:
it's really annoying.
Note: Same error in VS2012. I even tried restarting the whole computer, but no change.
Edit: Something in the Stackoverflow formatting screwed my text. Somehow you can't write a tag like < web: (just without the space) outside a code block.

Related

Ajax control toolkit asssembly reference error

Hi I am trying to install the ajax controll toolkit in an asp.net project.I have used Nugget to download the library into the project and loaded each control into the toolbox but when I try to use any of the controls I get this error:
Error 3 The type 'System.Web.UI.Design.ExtenderControlDesigner' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. D:\Projects IDE\Visual Studio\C# Book\ASP.NET\WebSite12\Default.aspx 14
After reading this error I added this in the configuration file:
<assemblies>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
I understand that this should point to the assembly I need but it does not work and also maybe someone can tell me from where should I have goten this string in the first place I have seen similar strings used for providersi in asp.net at the type property and I cant understand from where should I get them especialy the PublicKeyToken.
This is my entire code:
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:AlwaysVisibleControlDesigner ID="AlwaysVisible" runat="server">
</asp:AlwaysVisibleControlDesigner>
</form>
</body>
</html>
And this is the contents of the web.config file:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0" >
<assemblies>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation>
<pages>
<controls>
<add tagPrefix="asp" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
</system.web>
</configuration>
Also a second configuration file has been added after installing the ajax control toolkit via nugget called packages.config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AjaxControlToolkit" version="4.1.60919" targetFramework="net40" />
</packages>
What am I doing wrong here?Why am I getting that error?
EDIT
It turns out I had to add an aditional assembly for this to work:
<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"/>
</assemblies>
Now I am getting an error that says:
**Error 2 Type 'AjaxControlToolkit.AlwaysVisibleControlDesigner' does not have a public property named 'TargetControlID'. D:\Projects IDE\Visual Studio\C# Book\ASP.NET\WebSite12\Default.aspx 14
**
This is the code:
<asp:AlwaysVisibleControlDesigner ID="AlwaysVisible" runat="server" TargetControlID="Panel1" HorizontalOffset="10" HorizontalSide="Right" VerticalOffset="10" >
</asp:AlwaysVisibleControlDesigner>
I am prety sure that this should be corect I got this example from the book Proffesional asp.net in C# and VB
Somehow my code is not getting the ajaxcontrol toolkit properties.How can I corect this?
I faced this problem a long time ago.
The problem with my code was that it used two different versions of Ajax control toolkit.
The Toolbox had the latest Ajax control toolkit(the one With color picker, editor control) and the reference added in the project was of a older version.
How to solve:
Remove the Ajax Control tab from the toolbox.
Re-add the tab and right-click on the tab, Select Choose Items and browse to the
AjaxControltoolkit.dll file in your own project and press OK(Just
to make sure that we are using the same version in both the places)
Clean and rebuild the solution and you are ready to go.

How to register tagPrefix in app.config

in my ASP.net project's web.config I register the tagprefix cr as follows:
<pages>
<controls>
<add tagPrefix="cr" namespace="CrystalDecisions.Web" assembly="CrystalDecisions.Web,Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
</controls>
</pages>
I would like to start using configuration specific app.configs, but if I include the same setting in the app.config I get an error at compile time saying that the tagprefix is unrecognized
How can I force recognition of the tagprefix when it is in app.config instead of web.config
app.config is not used in a web project; anything you put in that file might as well not exist; ASP.NET and IIS completely ignore that file.

Element 'UpdatePanel' is not a known element

I have one master page in project. I added scripmanager in that page. In one aspx page I added only update panel control because script manager is in master page.I open both file of master page and save. Still I am getting an error Element 'UpdatePanel' is not a known element.
Found this here
Basically quit VS2010, delete the content of your 'Reflected Schema Cache', which should be in something like this:
C:\Users\[Your Username]\AppData\Roaming\Microsoft\VisualStudio\10.0\ReflectedSchemas
Restart VS and you should have fixed it.
I had similar issue and I figured that if we have UpdatePanel under "div" or "span" or even "asp:Content" the VS intellisense doesn't complain. Its strange though.
I was experiencing the same problem and also tried to drag and drop from the toolbox to no avail. I finally was able to solve it by adding the targetFramework="4.0" attribute to my compilation tag in my web.config file.
Put the following code in your web config. Just change assembly according to your Ajaxtoolkit
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit"/>
</controls>
</pages>
This is one way to resolve the 'Element 'UpdatePanel' is not a known element' error if you're using VS2008 or targetting earlier frameworks.
You need to explicitly include the following controls/namespaces in your web.config's pages section, contained within system.web.
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
<%# Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
I was getting this error in VS 2015 due to reference to 3.5 in System.Web.Extensions page directive. Make sure it's 4.0
Had the same problem when I changed from an older .Net to a later .Net 4 framework. Also changed to XHTML5.
In XHTML5 the is not allowed which was used, which affected parsing, which caused the error/warning.
Once I replaced with then it stopped the warnings.
Having the same problem, here is how I solved it:
With your ScriptManager, add it before your UpdatePanel, but close it's tag instead of putting the UpdatePanel and ContentTemplate inside of it.
<asp:ScriptManager ID="nonflashymanager" runat="server"/>
<asp:UpdatePanel id="nonflashyform" runat="server">
<ContentTemplate>
</ContentTemplate>
</UpdatePanel>

how to upgrade code to a new version of third party control

I have a web application in asp.net 3.5 where i have been using some third party controls i.e. Devexpresv9.2
and on the pages where i am using these controls i normally has to call the register tag on the page markup like for ex:
<%# Register Assembly="DevExpress.Web.v9.2, Version=9.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxCallback" TagPrefix="dxcb" %>
<%# Register Assembly="DevExpress.Web.ASPxGridView.v9.2.Export, Version=9.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxGridView.Export" TagPrefix="dxwgv" %>
Now i have updated the version of devexpress controls installed on my machine and it has stopped working because the version installed on my machine is v10.0 but my code is looking for v9.2
Please advise how can i modify my code in such a way that in future if i install another version then i don't have to modify all the pages and references again. May be something in web.config that can help me or anything generic??
Thanks
Use the project converter which is designed for this. It is located under the Windows Start Menu at "Develper Express V2010 vol1 -> Components -> Tools -> Project Converter". This will automatically change all of your references to the current version.
Project Converter Documentation
I think you answered your own question. You don't need to add the assembly reference on each page, put it in web.config.
<system.web>
<compilation>
<assemblies>
<add assembly="DevExpress.Web.v9.2, Version=9.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
<add assembly="DevExpress.Web.ASPxGridView.v9.2.Export, Version=9.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
</assemblies>
</compilation>
<pages>
<controls>
<add namespace="DevExpress.Web.ASPxCallback" assembly="DevExpress.Web.v9.2" tagprefix="dxcb">
<add namespace="DevExpress.Web.ASPxGridView.Export" assembly="DevExpress.Web.ASPxGridView.v9.2.Export" tagprefix="dxwgv">
</controls>
</pages>
</system.web>

Defining tagPrefixes in Web.config help

I am having a little bit of trouble getting my aspx pages to recognize my tagPrefixes.
I have the standard ASP ones defined...
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Then I have my custom controls defined below that but I do not think I am defining them properly because sometimes the page does not see any controls in the current context other times they work like a champ...
<add tagPrefix="mri" namespace="Mri.Controls" assembly="Mri.Controls"/>
<add tagPrefix="mri" namespace="Mri.Controls.Inputs" assembly="Mri.Controls"/>
<add tagPrefix="mri" namespace="Mri.Controls.Inputs.DropDowns" assembly="Mri.Controls"/>
<add tagPrefix="mri" namespace="Mri.Controls.Inputs.Search" assembly="Mri.Controls"/>
I have one namespace "Mri.Controls" and inside of that namespace I have several sub-folders, "Inputs" -> "DropDowns" etc...
What am I doing wrong? Currently the regular ASP controls are giving me an error: The name "blahBlah" does not exist in the current context.
The sub-folders may or maynot become part of the namespace. By default, Visual Studio does include them when creating new classes but that can be removed in the class. If you moved the controls to the sub-folders, then the folder's name is likely not part of the namespace.
Also, make sure you are referencing your controls assembly or project within Visual Studio.
Do you not also need the tagName attribute e.g.
<add tagPrefix="mri" tagName="Search" namespace="Mri.Controls.Inputs.Search" assembly="Mri.Controls"/>
<mri:Search ID="Search" runat="server"/>

Resources