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

DataFormatString - Money

3 Answers 380 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Orit
Top achievements
Rank 1
Orit asked on 16 Sep 2009, 08:11 AM
Hi I use DataFormatString  property in my gridColumn
thr problem is that when the number is negative
the minus is in the right side of the number instead of the left size
my grid is set to be RightToLeft cause its hebrew
this is my code

<GroupBox Name="gbAccountManagment" Margin="2,2,2,2" MaxHeight="580" Height="480" VerticalAlignment="Top" > 
                <GroupBox.Header> 
                    <Grid> 
                        <Grid.ColumnDefinitions> 
                            <ColumnDefinition></ColumnDefinition>  
                            <ColumnDefinition></ColumnDefinition>  
                        </Grid.ColumnDefinitions> 
                        <Button Grid.Column="0" Name="btnAccountManagmentPlus" Visibility="Hidden" Width="20" Click="btnAccountManagmentPlus_Click">+</Button> 
                        <Button Grid.Column="0"  Name="btnAccountManagmentMinus"  Width="20" Click="btnAccountManagmentMinus_Click">-</Button> 
                        <Label Grid.Column="1">ניהול חשבונות</Label> 
                    </Grid> 
                </GroupBox.Header> 
                <StackPanel> 
                    <StackPanel Orientation="Horizontal">  
                        <TextBlock Margin="100,5,5,5" FontWeight="Bold" Width="60">סוג תקציב</TextBlock> 
                        <ComboBox Name="cmbBudgetType" DisplayMemberPath="Name" Margin="5,5,5,5" Width="120" SelectionChanged="cmbBudgetType_SelectionChanged"></ComboBox> 
                        <TextBlock Margin="100,5,5,5" FontWeight="Bold" Width="60">סוג פעילות</TextBlock> 
                        <ComboBox Name="cmbActivityType" DisplayMemberPath="Name" Margin="5,5,5,5" Width="120" SelectionChanged="cmbActivityType_SelectionChanged"></ComboBox> 
                        <Button Name="btnFilter" Margin="30,5,5,5" Click="btnFilter_Click">הצג</Button> 
                        <Button Visibility="Hidden" Name="btnTry" Margin="30,5,5,5" Click="btnTry_Click">Try</Button> 
                    </StackPanel> 
                     <telerik:RadGridView Name="gvAccount" Margin="5,5,5,5" AutoGenerateColumns="False"   
                                         CanUserResizeColumns="False" CanUserReorderColumns="False"   
                                         CanUserFreezeColumns="False" ShowGroupPanel="False" CanUserSortColumns="False" 
                                         FlowDirection="RightToLeft" IsFilteringAllowed="False" ShowColumnHeaders="True" CanUserInsertRows="False">  
                        <telerik:RadGridView.Resources> 
                            <Style x:Key="ToolTipColumnStyle" TargetType="telerik:GridViewCell">  
                                <Setter Property="ToolTip" Value="{Binding Content,RelativeSource={RelativeSource Self}}" /> 
                            </Style> 
                        </telerik:RadGridView.Resources> 
                            <telerik:RadGridView.Columns> 
                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="BudgetTypeName" Header="תקציב"  Width="60"/>  
                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="Name" Header="שם חשבון/&#13;סעיף/תת סעיף"  Width="160" CellStyle="{StaticResource ToolTipColumnStyle}"/>                                  
                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="DisplayNum" Header="מס' חשבון/&#13;סעיף/תת סעיף" Width="110" /> 
                            <telerik:GridViewDataColumn IsReadOnly="True" DataFormatString="{}{0:#,##0.00}" UniqueName="TotalBudget" Header="הקצבה&#13;כוללת&#13;(אש''ח)"  Width="75"/>  
                            <telerik:GridViewDataColumn IsReadOnly="True" DataFormatString="{}{0:#,##0.00₪}" UniqueName="BalanceBudgetAllocation" Header="יתרה&#13;לתקצוב&#13;(אש''ח)" Width="75" /> 
                            <telerik:GridViewDataColumn IsReadOnly="True" DataFormatString="{}{0:#,##0.00₪}" UniqueName="SumBudgetRequest" Header="שריון &#13;לפעילויות&#13;(אש''ח)" Width="75"/>  
                            <telerik:GridViewDataColumn IsReadOnly="True" DataFormatString="{}{0:#,##0.00₪}" UniqueName="SumOrderAllocation" Header="התחייבות&#13;לפעילויות&#13;(אש''ח)" Width="75" /> 
                            <telerik:GridViewDataColumn IsReadOnly="True" DataFormatString="{}{0:#,##0.00₪}" UniqueName="SumOrderPaid" Header="שולם&#13;בפועל&#13;(אש''ח)"  Width="75"/>  
                            <telerik:GridViewDataColumn IsReadOnly="True" DataFormatString="{}{0:#,##0.00₪}" UniqueName="BalanceToPay" Header="יתרה&#13;לתשלום&#13;(אש''ח)" Width="75"/>  
                            <telerik:GridViewDataColumn IsReadOnly="True" DataFormatString="{}{0:#,##0.00₪}" UniqueName="ActivityTypeName" Header="סוג&#13;פעילות" Width="120"/>  
                        </telerik:RadGridView.Columns> 
..........


one more thing,
I'll thank you if you can give me an example of how to arange my controls
inside a GroupBox
so that the scrolls of my grid will not get crazy...

3 Answers, 1 is accepted

Sort by
0
Orit
Top achievements
Rank 1
answered on 16 Sep 2009, 11:49 AM

I managed to set the flow direction of the number by using

 <Style x:Key="FlowStyle" TargetType="telerik:GridViewCell">  
                            <Setter Property="FlowDirection" Value="LeftToRight" /> 
but I still have a little problem
I want to have the following format

₪ - 2,500.45 

I try-

DataFormatString="{}{0:₪#,##0.00}" 
when I use this format I get
- ₪ 2,500.45 
any idea?

about my second question- the scrolls of my grid
I managed to fix it by using DockPanel
0
Lavanya
Top achievements
Rank 1
answered on 18 Apr 2012, 06:30 AM
Hi,

I am using RAD GridView.I am pulling data from database and binding it to the gridview.For one column i need to divide by 60(to convert from seconds to minutes).The original source should be seconds as remaining manipulation will according to seconds.While displaying in the grid it should be in minutes.How can I do that??

Thanks in advance.

0
Lavanya
Top achievements
Rank 1
answered on 18 Apr 2012, 06:31 AM
Hi,

I am using RAD GridView.I am pulling data from database and binding it to the gridview.For one column i need to divide by 60(to convert from seconds to minutes).The original source should be seconds as remaining manipulation will according to seconds.While displaying in the grid it should be in minutes.How can I do that??

Thanks in advance.

Tags
GridView
Asked by
Orit
Top achievements
Rank 1
Answers by
Orit
Top achievements
Rank 1
Lavanya
Top achievements
Rank 1
Share this question
or