从代码隐藏中灰显按钮在IE中不起作用 [英] Greying out a button from code-behind does not work in IE

查看:286
本文介绍了从代码隐藏中灰显按钮在IE中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网页上有两个下拉式清单。行为如下:

I have two drop down lists on a page. The behavior is as follows:


  1. 在列表1中选择一些

  2. 列表2已启用

  3. 在列表2中选择某项

  4. 按钮已启用

我做上面的autopostback启用下拉列表。要切换按钮我使用下面的代码:

I am doing the above with autopostback enabled on the drop down lists. To toggle the button I use the code below:

if (ddlAvailablePrograms.SelectedValue != string.Empty)
{
     careerInfoLearnMoreSubmit.Enabled = true;
     careerInfoLearnMoreSubmit.Style.Remove("opacity");
     careerInfoLearnMoreSubmit.Style.Add("opacity", "1.0;");
}
else
{
     careerInfoLearnMoreSubmit.Enabled = false;
     careerInfoLearnMoreSubmit.Style.Remove("opacity");
     careerInfoLearnMoreSubmit.Style.Add("opacity", "0.5;");
}

这在Firefox中可以正常工作,但在IE中,第一个下拉列表按钮失去它的灰色外观风格。

This works fine in Firefox but in IE as soon as I make a selection in the first drop down list the button looses its greyed out style.

有什么建议如何在IE中解决这个问题?

Any suggestions how to fix this in IE?

感谢

b3n

Thanks,
b3n

推荐答案

透明度 CSS样式已知Internet Explorer的问题。

The opacity CSS style has known issues with Internet Explorer.

尝试将它添加到您的CSS样式表,而不是添加一个内联样式,添加一个类:

Try adding this to your CSS stylesheet, and instead of adding an inline style, add a class:

.opaque {
    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; 
    filter: alpha(opacity=50);                  
}

订单必须与上述完全相同。

Order has to be exactly like above.

此技术在此显示/使用: http://www.quirksmode .org / css / opacity.html

This technique is shown/used here: http://www.quirksmode.org/css/opacity.html

此外,我听说使用jQuery来应用不透明度是理想的,因为jQuery处理所有跨浏览器问题。这是一个选项吗?

Also, i have heard using jQuery to apply the opacity is ideal, because jQuery handles all cross-browser issues. Is that an option?

这篇关于从代码隐藏中灰显按钮在IE中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆