【问题标题】:how do i make spinning buttons functional when radnumerictextbox is in readonly mode..?当 radnumerictextbox 处于只读模式时,如何使旋转按钮起作用..?
【发布时间】:2013-01-05 10:52:14
【问题描述】:

当 radnumerictextbox 处于只读模式时,我如何使旋转按钮起作用..?

我正在使用带有旋转按钮的 Telerik... 我需要 RadNumericTextBox 处于只读模式,但它需要使用旋转按钮进行更新...

<telerik:RadNumericTextBox ID="radntxt_TimePickers" AutoPostBack="false" runat="server"
                                MinValue="1" MaxValue="20" ClientEvents-OnValueChanged="radntxt_TimePickers_CreateTimePickers" 
                                NumberFormat-AllowRounding="true" NumberFormat-DecimalDigits="0" NumberFormat-GroupSeparator="" 
                                IncrementSettings-InterceptMouseWheel="true" Width="40px" ShowSpinButtons="true" ReadOnly="true">
                               </telerik:RadNumericTextBox>

【问题讨论】:

    标签: asp.net telerik telerik-radinput


    【解决方案1】:

    听起来您想将其与旋转按钮一起设为只读或不设为只读。

    您可以使用此处找到的代码将其设为只读: http://www.telerik.com/community/forums/aspnet-ajax/input/radtextbox-set-read-only.aspx

    将其设置为 false 以使其可编辑。

    <script type="text/javascript">  
    function setReadOnly()  
    {  
        var TextBox1 = $find("<%= RadTextBox1.ClientID %>");  
        TextBox1._textBoxElement.readOnly = true;  
    }  
    </script>
    

    请注意,$find 专门用于 ASP.NET

    【讨论】:

    • 你做了什么只读的?在我给出的示例中, TextBox1._textBoxElement 变为只读。在您的情况下, radntxt_TimePickers 需要更改其只读属性。
    • 文本框变为只读...很好但是,当我点击相同文本框值的旋转按钮时,需要更改...
    • 那么当点击其中一个旋转按钮时使 .readOnly = false?
    【解决方案2】:

    我在文本框中添加了一个 OnKeyPress 客户端事件 然后添加了一个Javascript函数来取消事件

        <telerik:radnumerictextbox id="RadTextBox1" showspinbuttons="true" runat="server">  
             <ClientEvents OnKeyPress="OnKeyPress" />  
        </telerik:radnumerictextbox> 
    &lt;!-- begin snippet: js hide: false console: true babel: false --&gt;

    <script type="text/javascript"> 
    function OnKeyPress(sender, eventArgs) 
    { 
       eventArgs.set_cancel(true);    
    } 
    </script> 

    【讨论】:

      猜你喜欢
      • 2022-07-06
      • 2011-10-18
      • 1970-01-01
      • 2020-08-05
      • 2020-09-18
      • 1970-01-01
      • 2021-11-29
      • 2012-01-26
      • 2012-03-21
      相关资源
      最近更新 更多