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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set default datetime to current datetime in GridDateTimeColumn ?

Thread ID:

Created:

Updated:

Platform:

Replies:

146894 Aug 24,2019 05:17 AM UTC Aug 28,2019 01:59 PM UTC WinForms 3
loading
Tags: SfDataGrid
Cosyspro
Asked On August 24, 2019 05:17 AM UTC

Hello,
I have the following questions about GridDateTimeColumn :
1) How to change the default datetime in cell of the GridDateTimeColumn ?
2) I can select only date by clicking on combobox datetime in cell. How to select date and time in the same cell ?
Regards. 

Gowtham Gopalsamy [Syncfusion]
Replied On August 26, 2019 12:40 PM UTC

Hi Cosyspro,   
  
Thanks for your patience.   


 
 
S.No   
Query   
Response   
1   
How to change the default datetime in cell of the GridDateTimeColumn ?   
You can achieve your requirement to change the default datetime by using theFormat property in GridDateTimeColumn.   
  
Please refer the below code snippet.  
    
this.sfDataGrid1.Columns.Add(new GridDateTimeColumn() { MappingName ="OrderDate", HeaderText = "Order Date", Format = "MM/dd/yyyy" });   
   
     
Please refer to the following sample link,     
   
Please refer to the following UG link,     
2   
I can select only date by clicking on combobox datetime in cell. How to select date and time in the same cell ?   
We are analyzing your requirement to choose the date and time in GridDateTimeColumn. We will update more details with 28th August,2019. 
  
  
Please let us know if you require further assistance on this.  
 
Regards, 
Gowtham 


Cosyspro
Replied On August 27, 2019 01:32 PM UTC

Hi Gowtham,
Thanks for your reply.
I give more details about my previous question. When I click on datetime cell in the new row, the cell displays 01/01/0001 as default date. How to set the default datetime to date of today?
Regards 

Susmitha Sundar [Syncfusion]
Replied On August 28, 2019 01:59 PM UTC

Hi Cosyspro, 
 
Thank you for your patience. 
 
Please find the details for your queries, 
 
Query 
Detail 
I can select only date by clicking on combobox datetime in cell. How to select date and time in the same cell ?   
We have considered your requirement of “Edit the time value by SfDateTimeEdit DropDown popup” in WinForms and logged feature request for the same. We will implement this feature in any of our upcoming release.  
 
We appreciate your patience until then. 
 
You can also communicate with us regarding the open features any time using our Feature Report page.  
  
Feedback link
  
If you have any more specification/suggestions to the feature request, you can add it as a comment in the portal and cast your vote to make it count. 
 
When I click on datetime cell in the new row, the cell displays 01/01/0001 as default date. How to set the default datetime to date of today? 
Your requirement can be achieved by AddNewRowInitiating event. Please refer the below code snippet, 
C#: 
this.sfDataGrid1.AddNewRowInitiating += SfDataGrid1_AddNewRowInitiating; 
 
private void SfDataGrid1_AddNewRowInitiating(object sender, AddNewRowInitiatingEventArgs e) 
        { 
            var data = e.NewObject as OrderInfo; 
            data.OrderDate = DateTime.Now; 
        } 
 
 
 
Please contact us if you need further assistance. 
 
Regards, 
Susmitha S 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon