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

RadNumericTextbox 'Specified cast is not valid' problem

1 Answer 472 Views
Input
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 13 Nov 2008, 03:02 PM
Im trying to set a RadNumericTextbox to the value of 0 which is coming from the database. I keep getting the following error though when the value is trying to bind to the Rad control.

'Specified cast is not valid.'

The data type is an Integer which is set using the code below. If i change the value of Floors to be double this works fine for some reason?! Surely these controls can use integer data types?

Private _Floors As Integer 
    Public Property Floors() As Integer 
        Get 
            Return _Floors 
        End Get 
        Set(ByVal value As Integer
            _Floors = value 
        End Set 
    End Property 

Here is my code for the RadNumericTextbox

<telerik:RadNumericTextBox  
       Skin=""  
       Type="Number"  
       ID="Floors"  
       Value='<%# Bind("Floors") %>' 
       runat="server" /> 


Look forward to hearing your solutions.

Thanks in advance.
David

1 Answer, 1 is accepted

Sort by
0
Missing User
answered on 13 Nov 2008, 03:11 PM
Hello David,


With RadNumericTextbox, use the DbValue property rather than Value or Text properties.

You can review the following help article:
http://www.telerik.com/help/aspnet-ajax/input_commondatabinding.html

Best wishes,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Input
Asked by
David
Top achievements
Rank 1
Answers by
Missing User
Share this question
or