C# 元素[control_name]不是已知元素。如果网站中存在编译错误或Web.config文件丢失,则可能会发生这种情况
我知道这似乎是一个重复的问题,但相信我,我已经做了研究,没有发现对我有用的东西。所以在我重新安装VS 2013之前,你们是我唯一的希望 好的,在我继续之前,我正在使用Visual Studio 2013和.net framework,我对VS有一个非常温和的想法 这是我的aspx代码:C# 元素[control_name]不是已知元素。如果网站中存在编译错误或Web.config文件丢失,则可能会发生这种情况,c#,asp.net,.net,visual-studio,visual-studio-2013,C#,Asp.net,.net,Visual Studio,Visual Studio 2013,我知道这似乎是一个重复的问题,但相信我,我已经做了研究,没有发现对我有用的东西。所以在我重新安装VS 2013之前,你们是我唯一的希望 好的,在我继续之前,我正在使用Visual Studio 2013和.net framework,我对VS有一个非常温和的想法 这是我的aspx代码: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Images.aspx.cs" Inherits="TestPage.WebForm2"
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Images.aspx.cs" Inherits="TestPage.WebForm2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link rel="stylesheet" type="text/css" href="StyleSheet2.css" />
</head>
<body>
<form id="form1" runat="server">
<asp:Image ID="Image1" ImageUrl="~/Maze.png" runat="server" CssClass="ImgHolder" />
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click"/>
<asp:GridView ID="GridView1" runat="server" EmptyDataText="No Files found!" AutoGenerateColumns="false" CssClass="ImgGrid" OnRowDataBound="GridView1_RowDataBound" DataKeyNames="ImgNum, ImgContent">
<HeaderStyle Height="30px" BackColor="#FF9E66" Font-Size="15px" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" />
<RowStyle Height="20px" Font-Size="13px" HorizontalAlign="Center" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" />
<Columns>
<asp:BoundField DataField="ImgNum" HeaderText="#" />
<asp:Image runat="server"></asp:Image> <%--Here lies the problem--%>
</Columns>
</asp:GridView>
</form>
</body>
</html>
如您所见,我在两个地方使用了图像控件。虽然它在GridView之外工作得很好,但它(实际上是任何asp控件)向我显示:
元素[control_name]不是已知元素。如果网站中存在编译错误或Web.config文件丢失,则可能会发生这种情况
我已经试过:
- 关闭我的VS并转到
删除其中的所有缓存文件,然后打开它。零成功C:\Users\[username]\AppData\Roaming\Microsoft\VisualStudio\12.0\ReflectedSchemas
- 我甚至在另一个新项目中使用了相同的代码。零成功
- 一篇文章要求在
中检查.net framework的webconfig文件,但我在其中找不到4.5,所以我检查了4.0,根据文章的内容,一切似乎都很完美。尽管如此,我无法想象为什么目录中没有4.5是一个问题,因为所有其他控件都工作正常C:\Windows\Microsoft.net\framework
<asp:ImageField>
而不是
<asp:image>