We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Columns Format Change

Hi dear syncfusion team,

I looked in the forum but could not find a result,

I just want to turn the datetime format to smalldate

for example "21.06.2016 23:45:33" to "21.06.2016"
or
17,500 money to 17,500.00$ or 
17,500.00€ or 17,500.00TL


Waiting for your help.


Attachment: converting_9c28e689.rar

3 Replies

JG Jai Ganesh S Syncfusion Team June 21, 2016 01:57 PM UTC

Hi Hamit, 
Please find the responses for your queries as below, 
Query 1: 
You can change the DateTime format for DateTimeColumn. We already have a kb for this and please find the kb link below, 
Query 2: 
You can display your own symbol for currency column by using a CurrencySymbol property as like below, 
<Syncfusion:GridDataVisibleColumn MappingName="EmployeeSalary"> 
     <Syncfusion:GridDataVisibleColumn.ColumnStyle> 
 
           <Syncfusion:GridDataColumnStyle 
                                CellType="CurrencyEdit"  
                                NegativeForeground="Red" 
                                HorizontalAlignment="Right" > 
                  <Syncfusion:GridDataColumnStyle.NumberFormat> 
                            <glob:NumberFormatInfo  CurrencySymbol="€" CurrencyPositivePattern="1"  CurrencyNegativePattern="5"/> 
                  </Syncfusion:GridDataColumnStyle.NumberFormat> 
           </Syncfusion:GridDataColumnStyle> 
     </Syncfusion:GridDataVisibleColumn.ColumnStyle> 
 </Syncfusion:GridDataVisibleColumn> 
 
In the above sample, we have set the ‘ symbol  in CurrencySymbol property like this you will set $ or TL symbols. 

Regards, 
Jai Ganesh S 



HK Hamit KARAKAYA June 21, 2016 03:46 PM UTC

Thank you for your quick response,

summarry row mapping to autogenerate column name it's working, but GridDataVisibleColumn map to autogenerated column name and nothing changet the date column

<syncfusion:GridDataControl Name="fdg_rapor"
                                        AllowEdit="False"
                                        AllowGroup="True"
                                        AllowSort="True"
                                        AutoPopulateRelations="False"
                                        ShowAddNewRow="False"
                                        ShowGroupDropArea="True"
                                        HideColumnsWhenGrouped="False"
                                        FilterBarMode="Immediate"
                                        FilterBarPredicateType="And"
                                        GroupDropAreaText="BAŞLIKLARI BU ALANA SÜRÜKLEYİP GURUPLANDIRABİLİRSİNİZ"
                                        ShowFilterBar="True"
                                        VisualStyle="Metro"
                                        ColumnSizer="Star">

<syncfusion:GridDataControl.VisibleColumns>
                <syncfusion:GridDataVisibleColumn HeaderText="Tahsil Date" MappingName="Tahsil">
                    <syncfusion:GridDataVisibleColumn.ColumnStyle >
                        <syncfusion:GridDataColumnStyle HorizontalAlignment="Right" CellType="DateTimeEdit" >
                        <syncfusion:GridDataColumnStyle.DateTimeEdit>
                            <syncfusion:GridDateTimeEditStyleInfo DateTimePattern="ShortDate" />
                        </syncfusion:GridDataColumnStyle.DateTimeEdit>
                    </syncfusion:GridDataColumnStyle>
                </syncfusion:GridDataVisibleColumn.ColumnStyle>
                <syncfusion:GridDataVisibleColumn.HeaderStyle>
                        <syncfusion:GridDataColumnStyle Background="Green" HorizontalAlignment="Center" />
                </syncfusion:GridDataVisibleColumn.HeaderStyle>
            </syncfusion:GridDataVisibleColumn>
            </syncfusion:GridDataControl.VisibleColumns>
</syncfusion:GridDataControl.SummaryRows>

public Rapor_Tahsilat()
        {
            InitializeComponent();
            dt_rapor = Rapor.getir("bugun", dtpic_startdate.SelectedDate.Value.ToString("MM.dd.yyyy") , dtpic_finishdate.SelectedDate.Value.ToString("MM.dd.yyyy"));
            fdg_rapor.ItemsSource =
dt_rapor;
         }

           GridDataVisibleColumn mapping to date column, nothing ever changes

my goal
dt_rapor.Columns[5]  Header "Tahsil" = <syncfusion:GridDataVisibleColumn HeaderText="Tahsil Date" MappingName="Tahsil">
dt_rapor.Columns[5]  = 1.1.2016 25:17:15
griddatacolumn        
= 01.01.2016        

I thought I would tell hope


in addition

<syncfusion:GridDataVisibleColumn HeaderText="Tahsilat" MappingName="Tahsilat">
                    <syncfusion:GridDataVisibleColumn.ColumnStyle >
                        <syncfusion:GridDataColumnStyle 
                                CellType="CurrencyEdit" 
                                NegativeForeground="Red"
                                HorizontalAlignment="Right" >
                            <syncfusion:GridDataColumnStyle.NumberFormat>
                                <Syncfusion:GridDataColumnStyle.NumberFormat>
gives error The attachable property 'NumberFormat' was not found in type 'GridDataColumnStyle'.   
                                    <glob:NumberFormatInfo  CurrencySymbol="€" CurrencyPositivePattern="1"  CurrencyNegativePattern="5"/>
                            </syncfusion:GridDataColumnStyle.NumberFormat>
                        </syncfusion:GridDataColumnStyle>
                    </syncfusion:GridDataVisibleColumn.ColumnStyle>
                    <syncfusion:GridDataVisibleColumn.HeaderStyle>
                        <syncfusion:GridDataColumnStyle Background="Pink" HorizontalAlignment="Center" />
                    </syncfusion:GridDataVisibleColumn.HeaderStyle>
                </syncfusion:GridDataVisibleColumn>

Thank you for your response



JG Jai Ganesh S Syncfusion Team June 22, 2016 05:58 PM UTC

Hi Hamit, 
 
Query 1: 
 
We suspect that, you want to set the format for DataTimeColumn in code behind. You can achieve this by using QueryCellInfo event, 
 
this.grid.ModelLoaded += grid_ModelLoaded; 
 
void grid_ModelLoaded(object sender, EventArgs e) 
{ 
    grid.Model.QueryCellInfo += Model_QueryCellInfo; 
} 
 
void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) 
 { 
     if (grid.VisibleColumns[e.Cell.ColumnIndex].MappingName == "DOB") 
     { 
         e.Style.CellType = "DateTimeEdit"; 
 
         e.Style.DateTimeEdit.DateTimePattern = DateTimePattern.LongDate; 
     } 
 }      
 
 
Query 2: 
 
We have checked the issue in our sample but the NumberFormat issue is not reproduced and it is working fine in our side. Could you please recheck in your end? 
 
Regards, 
 
Jai Ganesh  


Loader.
Up arrow icon