Date part only of a DateTime

3 posts, 1 answers
  1. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 04 Jun 2010 Link to this post

    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. Answer
    Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 04 Jun 2010 Link to this post

    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.
  3. DevCraft banner
  4. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 04 Jun 2010 Link to this post

    I can't mark my own message as answered thought
Back to Top