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

来源:https://wwwdev.cn/article/20101221/aspx-html-remark-can-not-have-runat-server-content.aspx

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

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


分析器错误

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

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

源错误:
 

行 11: </asp:GridView>
行 12: <input type="button" οnclick="" 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


  测试代码如下
<%@ 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" οnclick="" value="马上更新" /> </form><!--一定不能缺少runat= "server"的表单,要不然ajaxpro不会自动生成对应的脚本和导入相关的框架代码--> </body> </html>

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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

斯洛文尼亚旅游

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值