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

RadNumeric Textbox Problem

1 Answer 118 Views
Input
This is a migrated thread and some comments may be shown as answers.
Atchut
Top achievements
Rank 1
Atchut asked on 02 May 2012, 03:38 PM
Hello,
I am using radnumeric textbox to enter discount at highlevel. If the user changes the discount on other items in the page, I want to clear the RadNumeric Textbox value. I am clearing the textbox using JQuery. On the UI, it is showing as cleared but again when I click on textbox, it is showing the value and on postback also that textbox is showing the same value. Is there any settings I have to change in RadNumeric Textbox
Here is my Code.

  <telerik:RadNumericTextBox  ID="txtDiscountlevel" runat="server" CssClass="BodyCopy" MaxLength="5" AutoCompleteType="None"  
                                      Type="Number" ShowSpinButtons="false" AllowOutOfRangeAutoCorrect="false" InvalidStyle-Font-Bold="true">
                                      <NumberFormat AllowRounding="false" DecimalDigits="3"  KeepNotRoundedValue="true" GroupSizes="4"/>
                                  </telerik:RadNumericTextBox> 

                      <telerik:RadNumericTextBox  ID="txtNewPrice" runat="server" MaxLength="10"  AutoCompleteType="None"  MinValue="0"  CssClass="CurPriceTxtbox" 
                            Width="50px"  Type="Number" ShowSpinButtons="false" AllowOutOfRangeAutoCorrect="false" InvalidStyle-Font-Bold="true">
                                      <NumberFormat AllowRounding="false" DecimalDigits="2"  KeepNotRoundedValue="true" GroupSizes="3"/>
                                       <ClientEvents OnValueChanging="ValueChanged" OnError="HandleError"/>
                                  </telerik:RadNumericTextBox>

function ValueChanged(sender, args) {
          $("#txtDiscountlevel_text").val('');
             }

1 Answer, 1 is accepted

Sort by
0
Accepted
Richard
Top achievements
Rank 1
answered on 03 May 2012, 08:22 PM
Atchut:

Try this JavaScript to clear your "txtDiscountlevel" RadNumericTextBox control:

<script type="text/javascript">
    function ValueChanged(sender, args) {
        alert('fired');
        var txtDiscountlevel = $find("<%= txtDiscountlevel.ClientID %>");
        txtDiscountlevel.clear();
    }
</script>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
</telerik:RadAjaxManager>
<div>
    <telerik:RadNumericTextBox ID="txtDiscountlevel" runat="server" CssClass="BodyCopy"
        MaxLength="5" AutoCompleteType="None" Type="Number" ShowSpinButtons="false" AllowOutOfRangeAutoCorrect="false"
        InvalidStyle-Font-Bold="true">
        <numberformat allowrounding="false" decimaldigits="3" keepnotroundedvalue="true"
            groupsizes="4" />
    </telerik:RadNumericTextBox>
    <br />
    <telerik:RadNumericTextBox ID="txtNewPrice" runat="server" MaxLength="10" AutoCompleteType="None"
        MinValue="0" CssClass="CurPriceTxtbox" Width="50px" Type="Number" ShowSpinButtons="false"
        AllowOutOfRangeAutoCorrect="false" InvalidStyle-Font-Bold="true">
        <numberformat allowrounding="false" decimaldigits="2" keepnotroundedvalue="true"
            groupsizes="3" />
        <clientevents onvaluechanging="ValueChanged" />
    </telerik:RadNumericTextBox>

Hope this helps!
Tags
Input
Asked by
Atchut
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or