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

Date part only of a DateTime

2 Answers 77 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marc Roussel
Top achievements
Rank 2
Marc Roussel asked on 04 Jun 2010, 10:54 AM
Hi,

How can I have just the date part of a date in this code when adding a new column ?
Because actually I see the date and the hour

Telerik.Windows.Controls.GridViewDataColumn gvdc = new Telerik.Windows.Controls.GridViewDataColumn();  
 
if (FrenchCaption != "")  
    gvdc.Header = FrenchCaption;  
else 
    gvdc.Header = EnglishCaption;  
 
gvdc.IsVisible = IsVisible;  
gvdc.IsReadOnly = IsReadOnly;  
 
if (Width != -1)  
    gvdc.Width = Width;  
 
gvdc.SortingState = SortingState;  
 
if (IsGroupped)  
    if (SortGroupBy != null)  
        GridView.GroupDescriptors.Add(new GroupDescriptor() { DisplayContent = BindingPath, Member = BindingPath, SortDirection = SortGroupBy });  
    else 
        GridView.GroupDescriptors.Add(new GroupDescriptor() { DisplayContent = BindingPath, Member = BindingPath });  
 
gvdc.DataMemberBinding = new System.Windows.Data.Binding(BindingPath);  
 
GridView.Columns.Add(gvdc);  
 

2 Answers, 1 is accepted

Sort by
0
Accepted
Marc Roussel
Top achievements
Rank 2
answered on 04 Jun 2010, 11:08 AM
Ok it's DataFormatString but I need to check if it's a Date first but this is a method that doesn't know about the DataType yet However I did pass the DataFormatString by parameter to the method because the caller knows.

So it worked and I wanted to share it.
0
Marc Roussel
Top achievements
Rank 2
answered on 04 Jun 2010, 11:08 AM
I can't mark my own message as answered thought
Tags
GridView
Asked by
Marc Roussel
Top achievements
Rank 2
Answers by
Marc Roussel
Top achievements
Rank 2
Share this question
or