This is a migrated thread and some comments may be shown as answers.

Default Value RadNumericTextbox

3 Answers 1107 Views
Input
This is a migrated thread and some comments may be shown as answers.
benitolopez_sistemas
Top achievements
Rank 1
benitolopez_sistemas asked on 03 May 2010, 12:47 AM
I have 5 RadNumericTextbox, but I need when the user clears the input area it must always have a default value of "0", I don't need a validator, only I need before the callback is made the RadNumericTextboxes are filled with this default value.

Thanks.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 May 2010, 07:08 AM

Hello,

One suggestion would be attaching the 'OnBlur' client event and resetting the textbox value to zero when user clears the value. Here is the example.

ASPX:

 
<telerik:RadNumericTextBox ID="RadNumericTextBox1" Value="0" runat="server">  
    <ClientEvents OnBlur="OnBlur" />  
</telerik:RadNumericTextBox> 

JavaScript:

 
<script type="text/javascript">  
    function OnBlur(sender, args) {  
        if (sender.get_value() == "") {  
            sender.set_value("0");  
        }  
    }  
</script>  
 

-Shinu.

0
benitolopez_sistemas
Top achievements
Rank 1
answered on 03 May 2010, 11:21 PM
Thanks.

One more question, the code you share works fine, but I have a radnumerictextbox with autopostback=true. Without your code, the loading image shows(before) and hides(after) the postback, but with your code the images shows(before) and it still shows(after) the postback.

Can you help please?

This is the code for the panel loading:
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel3" runat="server" Skin="" Transparency="30" OnClientShowing = "fnS" OnClientHiding = "fnH" MinDisplayTime="1000"
            <div class="loading"
                <asp:Image ID="Image1" runat="server" ImageUrl="~/img/loading1.gif" AlternateText="loading" /> 
            </div> 
        </telerik:RadAjaxLoadingPanel> 

The javascript code is:
function fnS(sender, args) { args.get_loadingElement().style.border = "1px solid grey"; args.set_cancelNativeDisplay(true); $telerik.$(args.get_loadingElement()).show("slow"); }  
 
function fnH(sender, args) { args.get_loadingElement().style.border = "1px solid blue"; args.set_cancelNativeDisplay(true); $telerik.$(args.get_loadingElement()).hide("slow"); } 
 



0
Shinu
Top achievements
Rank 2
answered on 04 May 2010, 02:54 PM
Hello,

I hope the aproach of explicitly showing/hiding the RadAjaxLoadingPanel in OnRequestStart/OnResponseEnd methods will help you in achieving this.

The following documentation describes more on this topic:

Show and hide loading panel explicitly

Regards,
Shinu.

Tags
Input
Asked by
benitolopez_sistemas
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
benitolopez_sistemas
Top achievements
Rank 1
Share this question
or