How was the Following Value calculated
Good Day
i have a RadMaskedTextBox which gets binded with the following value from the DB
Code:
<telerik:RadMaskedTextBox IsEnabled="False" Height="22" HorizontalAlignment="Right" Mask="p1" MaskType="Numeric" MaskedText="0" EmptyContent="0" Margin="0,281,880,0" Name="RETURNONASSETS" telerik:StyleManager.Theme="Metro" VerticalAlignment="Top" Width="227" TabIndex="8" SelectionOnFocus="SelectAll" Grid.Column="1" />
<b>0.0473445085040537 </b>
and on the application it format the value as
which is Correct , now i want to understand how did it come to 4.7 , i tried this
Code:
select round(0.0473445085040537,2)
select round(0.0473445085040537,3)
but my calc here does not give me 4.7 , i need help with this TSQL to make it 4.7
Re: How was the Following Value calculated
Hi,
You need to check that the rounding logic in SQL is the same as the rounding logic in the telerik:RadMaskedTextBox control and if so you can do it like this:-
Code:
SELECT CAST(CAST(0.0473445085040537 * 100 AS decimal(4, 1)) AS nvarchar(5)) + N'%' AS myPercentage
Hope that helps.
Cheers,
Ian