简体   繁体   English

ASPx控件焦点不起作用

[英]ASPx control focus not working

I want to apply an effect on focus upon a <dx:ASPxTextBox control> . 我想对<dx:ASPxTextBox control>施加效果。 Here is what I tried : 这是我尝试的:

<dx:ASPxTextBox ID="tb_name" runat="server" Focused-CssClass="txtBox"></dx:ASPxTextBox>

And here is my focused class css : 这是我的重点课程css:

<style>
    .txtBox:focus {
        border-color : red;
        transition : 0.5s linear;
    }
</style>

When I try it, it seems the focus state of my css isn't applied when I click on my textBox. 当我尝试它时,当我单击文本框时,似乎没有应用CSS的焦点状态。 I tried the exact same with a simple <asp:TextBox> and it works well, so my css isn't involved. 我用一个简单的<asp:TextBox>尝试了完全相同的方法,并且效果很好,所以不涉及CSS。

How can I perform this with a DevelopperExpress control <dx:ASPxTextBox> ? 如何使用DevelopperExpress控件<dx:ASPxTextBox>执行此操作?

Thanks to @Darren, the solution is to separate the :focus state in a single css class. 感谢@Darren,解决方案是将:focus状态分离到单个CSS类中。 Here is the step to do : 这是要做的步骤:

<dx:ASPxTextBox ID="tb_name" runat=server" CssClass="txtBox">
    <FocusedStyle CssClass="txtBoxFocused"></FocusedStyle>
</dx:ASPxTextBox>

The focus state isn't shared with the "basic" state. 焦点状态不与“基本”状态共享。 And here is the css : 这是css:

<style>
    .txtBox {
        border-color : black;
        border-width : 1px;
        transition : 0.5s linear;
    }

    .txtBoxFocused {
        border-color : red;
        border-width : 1px;
        transition : 0.5s linear;
    }
</style>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM