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

Catering for DBNull.Value items.

1 Answer 63 Views
Input
This is a migrated thread and some comments may be shown as answers.
Ian Coetzer
Top achievements
Rank 2
Ian Coetzer asked on 17 Nov 2008, 11:00 AM
Hi

How can I set values (bind) to the RadNumericInput control:
(as shown below)

Value='<%# DataBinder.Eval(Container, "DataItem.Salary")%>'    

But cater for DbNull.Value values?
The users do not want to see the value zero "0.0000" they want to be able to see that the value is null, nothing / blank textbox.
I receive a "Specified cast is not valid." error message if I try and bind it to a datatable with some Null values.

Here is my full RadNumericTextBox control declaration:

                        <telerik:RadNumericTextBox ID="radNumericTextBox" runat="server" Type="Number" 
                            Value='<%# DataBinder.Eval(Container, "DataItem.Salary")%>'                           
                            LabelCssClass="radLabelCss_Web20" Skin="Telerik" Width="80px" style="TEXT-ALIGN: left"   
                            Font-Size="8pt" > 
                            <NumberFormat DecimalDigits="4" /> 
                            <FocusedStyle BorderColor="Red" BorderStyle="Double" /> 
                            <HoveredStyle BorderColor="Red" BorderStyle="Double" /> 
                        </telerik:RadNumericTextBox> 

1 Answer, 1 is accepted

Sort by
0
Missing User
answered on 17 Nov 2008, 11:11 AM
Hello Ian,


To see more information on the requested functionality, please refer to the following article:

All the best,
Plamen
the Telerik team

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