控制由 DataPager 呈现的禁用分页链接 (a[disabled=“disabled”]) 的外观
我有一个带有下一个和上一个按钮的数据分页器,如下所示:
<asp:DataPager ID="dpFeaturedPager" PagedControlID="lvFeaturedTips" QueryStringField="ftpg" PageSize="1" runat="server">
<Fields>
<asp:nextpreviouspagerfield ButtonCssClass="featured-previous" PreviousPageText="Previous" ShowNextPageButton="false" />
<asp:nextpreviouspagerfield ButtonCssClass="featured-next" NextPageText="Next" ShowPreviousPageButton="false" />
</Fields>
</asp:DataPager>
当只有一个页面可用时,下一个和上一个链接将呈现如下:
<a disabled="disabled">Previous</a>
我以前没有见过这个禁用的标签,并假设它来自我赢得的数据分页器控件无法控制。
像往常一样,这在 FireFox 上没问题,但在 IE7 上,上一个和下一个文本无法正确呈现 - 它已被概述(老实说,我希望禁用看起来像 - 但在页面中看起来有点难看!)
我可以控制吗这是CSS中的,还是一个已知问题?
谢谢 邓肯
I have a datapager with next and previous buttons as so:
<asp:DataPager ID="dpFeaturedPager" PagedControlID="lvFeaturedTips" QueryStringField="ftpg" PageSize="1" runat="server">
<Fields>
<asp:nextpreviouspagerfield ButtonCssClass="featured-previous" PreviousPageText="Previous" ShowNextPageButton="false" />
<asp:nextpreviouspagerfield ButtonCssClass="featured-next" NextPageText="Next" ShowPreviousPageButton="false" />
</Fields>
</asp:DataPager>
When there is only one page available, the Next and Previous links are rendered as so:
<a disabled="disabled">Previous</a>
I have not seen this disabled tag before, and presume it's coming from the datapager control which I won't be able to control.
As usual, this is fine on FireFox but on IE7 the Previous and Next text does not render correctly - it is outlined (what I would expect disabled to look like to be honest - but looks a bit ugly in the page!)
Can I control this in CSS, or is this a known issue?
Thanks
Duncan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
查看 StackOverflow 上的这个帖子,他们对 CSS 样式有一些建议对于禁用的链接和控件。希望有帮助!
编辑:看起来选择器属性在 IE6 中不起作用。
Check out this thread on StackOverflow, they have some suggestions on CSS styling for disabled links and controls. Hope it helps!
Edit: Doesn't look like the selector attribute will work in IE6.
您无法在 IE 中设置禁用控件的颜色。您可以更改背景或边框,但颜色将始终保持灰色并带有白色阴影(系统颜色)。即使在 IE9 中也不起作用。
关于此问题的主题:如何更改使用 css 的 IE8 中禁用的 html 控件的颜色。
You cannot set color of disabled control in IE. You can change background or border, but the color will always stay gray with white shadow (system color). It does not work even in IE9.
Thread about this issue: How to change color of disabled html controls in IE8 using css.
使用 jQuery removeAttr() 的快速解决方案:
这:
变成了这样:
Quick solution using jQuery removeAttr():
This:
Becomes This:
我向下一个和上一个链接添加了一类“btnDisable”,然后使用 CSS...
只需确保将 RenderDisabledButtonsAsLabels 设置为 True。
I added a class of 'btnDisable' to both the next and previous links then used CSS...
Just make sure you set RenderDisabledButtonsAsLabels to True.
对于那些仍在寻找此问题的人,从 .net 4.0 开始,您可以在 web.config 文件中定义 .net 控件的 HTML 兼容性。
然后,在 Global.asax.cs 中,您可以指定应用于禁用控件的 CSS 类 .net。
For those that still look for this issue, from .net 4.0 you have the possibility to define in the web.config file the HTML compatibility for .net controls.
Then in the Global.asax.cs you can specify the CSS class .net should apply to disabled controls.