呈现时如何从WebControl中删除span标签

编程入门 行业动态 更新时间:2024-10-28 21:27:02
本文介绍了呈现时如何从WebControl中删除span标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当使用ASP.NET CheckBox(在少数情况下,继承自CheckBox)时,它将在复选框输入控件周围呈现一个跨度,该跨度控件会影响jQuery脚本.

When using an ASP.NET CheckBox (and in out case, inherited from a CheckBox) it renders a span around the checkbox input control, this span control is affecting jQuery scripts.

渲染时是否可以删除该跨度?

Is it possible to remove this span when rendering?

推荐答案

找到了这个有用的提示:

Found this useful tip:

在后面的代码中,使用InputAttributes而不是Attributes.

In Code Behind, use InputAttributes instead of Attributes.

例如,键入:

chk.InputAttributes.Add("onchange", "updateFields()")

代替此:

chk.Attributes.Add("onchange", "updateFields()")

或代替内联声明:

<asp:CheckBox ID="chk" runat="server" onchange="updateFields()" />

最后两个会引起环绕间距.

The last two will cause the wrapping span.

更多推荐

呈现时如何从WebControl中删除span标签

本文发布于:2023-11-11 17:04:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1579048.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:标签   WebControl   span

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!