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

RadInputManager and 0

3 Answers 141 Views
Input
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 21 Feb 2009, 02:03 PM
I am using RadInputManager to create a series of numeric text boxes. Although 0 is an allowed value, when submitting the form the text box is cleared.

Here is the sample code I have been using to test this:

 

<asp:ScriptManager ID="SM1" runat="server" />

 

 

<telerik:RadInputManager ID="RIM1" runat="server">

 

 

<telerik:NumericTextBoxSetting BehaviorID="Number" DecimalDigits="2" MaxValue="9999.99" MinValue="0.00" EmptyMessage="Type something" Type="Number">

 

 

<TargetControls>

 

 

<telerik:TargetInput ControlID="TestBox" />

 

 

</TargetControls>

 

 

</telerik:NumericTextBoxSetting>

 

 

</telerik:RadInputManager>

 

 

<asp:TextBox ID="TestBox" runat="server" />

 

 

<asp:Button ID="Submit" runat="server" Text="Submit" />

 

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 23 Feb 2009, 07:22 AM
Hi Andrew,

I tried your code also replicate the same issue and here is one forum discussing the similar issue.
NumericTextBoxSetting empty 0.0 TextBox

I tried workaround for this, by using hiddenfield and setting the TextBox value explicitly from server side. Give a try with this.
ASPX:
<asp:Button ID="Submit" runat="server" Text="Submit"  OnClientClick="check();"/>  
<asp:HiddenField ID="HiddenField1" runat="server" Value="0"/> 

JavaScript:
<script type="text/javascript">  
function check()  
{  
    var textbox= document.getElementById("TestBox");  
    var hf= document.getElementById("HiddenField1");  
    if(textbox.value=="Type something")  
        hf.value="Type something";  
    else 
        hf.value="0";  
}  
</script> 

C#:
protected void Page_Load(object sender, EventArgs e)  
{  
    if (IsPostBack && TestBox.Text == "" && HiddenField1.Value=="0")  
    {  
        TestBox.Text = "0.00";  
    }  
Hope this help you.

Thanks,
Princy.
0
Andrew
Top achievements
Rank 1
answered on 23 Feb 2009, 07:28 AM

Hi Princy,

Thanks for the link, I was hoping it wouldn't come to a workaround though!

0
Andrew
Top achievements
Rank 1
answered on 24 Feb 2009, 05:30 PM

I have identified the troublesome line in the RadInputManager.js file, but using this instead of the embedded script causes issues because NumberFormat is undefined. I could not find it defined any script included with Q3.

Tags
Input
Asked by
Andrew
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Andrew
Top achievements
Rank 1
Share this question
or