0

当 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>
4

2 回答 2

2

It sounds like you want to make it readonly or not along with the spinning buttons.

You could use the code found here to make it readonly: http://www.telerik.com/community/forums/aspnet-ajax/input/radtextbox-set-read-only.aspx

Set it to false to make it editable.

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

Note that $find is specifically for ASP.NET

于 2013-01-05T11:23:56.033 回答
1

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

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

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

于 2018-03-22T13:35:53.583 回答