“HTML页面的 ID” 和 “asp.net 页面的ID” 的不同?

starrycheng 2014-10-15 06:21:11
<input type="radio" name="activity" id="ajax/notify/mail.html" >

id="ajax/notify/mail.html" 在 “HTML”页面中正常,但是在aspx页面中就会报错。错误信息如下:



为什么 “HTML页面的 ID” 和 “asp.net 页面的ID” 会不同呢???
...全文
360 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
醉了。。。。
threenewbee 2014-10-16
  • 打赏
  • 举报
回复
id里面加上反斜杠干嘛,你在任何现有的网站中见过这样的么?
wzhenhang 2014-10-16
  • 打赏
  • 举报
回复
必须是。aspx文件
starrycheng 2014-10-16
  • 打赏
  • 举报
回复
<div class="ajax-dropdown">

<!-- the ID links are fetched via AJAX to the ajax container "ajax-notifications" -->
<div class="btn-group btn-group-justified" data-toggle="buttons">
<label class="btn btn-default">
<input type="radio" name="activity" id="ajax/notify/mail.html" >
Msgs (14) </label>
<label class="btn btn-default">
<input type="radio" name="activity" id="ajax/notify/notifications.html">
notify (3) </label>
<label class="btn btn-default">
<input type="radio" name="activity" id="ajax/notify/tasks.html">
Tasks (4) </label>
</div>

<!-- notification content -->
<div class="ajax-notifications custom-scroll">

<div class="alert alert-transparent">
<h4>Click a button to show messages here</h4>
This blank page message helps protect your privacy, or you can show the first message here automatically.
</div>

<i class="fa fa-lock fa-4x fa-border"></i>

</div>
<!-- end notification content -->

<!-- footer: refresh area -->
<span> Last updated on: 12/12/2013 9:43AM
<button type="button" data-loading-text="<i class='fa fa-refresh fa-spin'></i> Loading..." class="btn btn-xs btn-default pull-right">
<i class="fa fa-refresh"></i>
</button>
</span>
<!-- end footer -->

</div>




一个HTML模板,它把路径名直接作为了ID,这样在HTML里面没有问题,但是在asp.net页面里面就会有问题。
Justin-Liu 2014-10-16
  • 打赏
  • 举报
回复
醉了。。。
天下如山 2014-10-16
  • 打赏
  • 举报
回复
这种命名 我也醉了。
  • 打赏
  • 举报
回复
这种ID命名方式也是醉了
  • 打赏
  • 举报
回复
一个在 服务端 一个在 浏览器
宝_爸 2014-10-16
  • 打赏
  • 举报
回复
使用正常一点的ID好不好,不要给自己找麻烦。
  • 打赏
  • 举报
回复
哦,晕死,我以为你写的是 asp.net 控件的ID。 对于html中id的规则,你应该学习一下 html/javascript 啊。 而你贴出的明明写着“javascript运行时错误”,你怎么能谎称“asp.net页面的ID”呢?
  • 打赏
  • 举报
回复
本来就不是同一个东西啊?!输出到客户端的id,是控件的 ClientID 属性动态获取出来的。 id读取方法都能搞错,你的asp.net老师没有教会你 asp.net 基本知识啊。
cykb518 2014-10-15
  • 打赏
  • 举报
回复
理论上是不能这样命名的,如果是纯HTML页面是可以直接在browser 里面呈现。 但是Asp.net的必须要在server上render 成html 然后再在brower里面呈现
moonwrite 2014-10-15
  • 打赏
  • 举报
回复
因为我们在aspx.cs中会用到这个id
ajax/notify/mail.html
.Click 违反C#的命名规范 <input type="radio" name="activity" id="xxx" data-url="ajax/notify/mail.html" >

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧