我知道这可能看起来像是一个重复的问题,但相信我,我做了我的研究,发现没有什么对我有用。所以在我必须重新安装VS 2013之前,你们是我唯一的希望
是的,在我进一步讨论之前,我正在使用带有.net框架的Visual Studio 2013,我对VS有一个非常温和的想法。
这是我的aspx代码:
<%@ 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>
如您所见,我在2个地方使用过Image控件。虽然它在GridView之外完美运行,但它(实际上是任何asp控件)都向我展示:
元素[control_name]不是已知元素。如果网站中存在编译错误,或者缺少web.config文件,则会发生这种情况。
我已经尝试过了:
C:\Users\[username]\AppData\Roaming\Microsoft\VisualStudio\12.0\ReflectedSchemas
删除其中的所有缓存文件,然后打开它。零成功。C:\Windows\Microsoft.NET\Framework
中.net框架的webconfig文件,但我找不到4.5,所以我检查了4.0,根据文章,一切看起来都很完美。虽然,我无法想象如果目录中没有4.5是一个问题,因为所有其他控件都工作正常所以,正如你所看到的,我已经在这方面投入了大量的工作并且没有成功。
那么,请告诉我我错过了什么?或者我是否必须重新安装Visual Studio?
答案 0 :(得分:1)
在标签“列”中你只能设置列,你不能添加你想要的永远的asp元素。如果您的网格有一个只有图像的列,则必须使用
<asp:ImageField>
而不是
<asp:image>
答案 1 :(得分:0)
当您的构建网站成功并且获取元素 [control_name] 不是已知元素时。如果网站中存在编译错误或缺少 web.config 文件,就会发生这种情况。
您可以将用于验证的目标架构更改为 HTML5。之后它不会在控制器中显示错误。