aspx页面的html注释中不能出现ruant="server"

  今天在弄一个aspx页面时,如果在aspx页面中添加html注释时,如果注释内容包含runat="server"内容,就会出现“服务器标记的格式不正确。”的错误,搞幽了。。

“/”应用程序中的服务器错误。

分析器错误

说明: 在分析向此请求提供服务所需资源时出错。请检查下列特定分析错误详细信息并适当地修改源文件。

分析器错误消息: 服务器标记的格式不正确。

源错误:

行 11: </asp:GridView> 行 12: <input type="button" onclick="" value="马上更新" /> 行 13: </form><!--一定不能缺少runat= "server"的表单,要不然ajaxpro不会自动生成对应的脚本和导入相关的框架代码--> 行 14: </body> 行 15: </html>

源文件: /ajaxpro-no-refresh-update-gridview.aspx    行: 13


版本信息: Microsoft .NET Framework 版本:2.0.50727.4952; ASP.NET 版本:2.0.50727.4955

  测试代码如下
+展开
-HTML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ajaxpro-no-refresh-update-gridview.aspx.cs" Inherits="ajaxpro_no_refresh_update_gridview" %>
<!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>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <title>ajaxpro无刷新定时更新gridview数据</title>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView runat="server" ID="gv1">
</asp:GridView>
<input type="button" onclick="" value="马上更新" />
</form><!--一定不能缺少runat= "server"的表单,要不然ajaxpro不会自动生成对应的脚本和导入相关的框架代码-->
</body>
</html>

  删除注释中的runat="server",就不会出现错误了,微软还蛮搞幽的~~

加支付宝好友偷能量挖...


原创文章,转载请注明出处:aspx页面的html注释中不能出现ruant="server"

评论(0)Web开发网
阅读(232)喜欢(0)Asp.Net/C#/WCF