---
title: "automatic time display in grid view column"  
description: "automatic time display in grid view column"  
author: "suresh g"  
published: 2011-12-28  
updated: 2026-05-15  
canonical: https://www.mindstick.com/forum/372/automatic-time-display-in-grid-view-column  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# automatic time display in grid view column

in [grid view](https://www.mindstick.com/forum/477/grid-view) one [column name](https://www.mindstick.com/forum/369/how-can-i-add-a-column-name-to-my-grid) is [date](https://yourviews.mindstick.com/story/3869/propose-day-2024-exciting-date-ideas-for-you-and-your-partner)/time. when we will [insert](https://www.mindstick.com/blog/173/executing-insert-delete-or-update-query-in-sqlserver-using-ado-dot-net) the record through grid view the date/time record will automatically [store](https://www.mindstick.com/articles/13125/tips-to-increase-sales-of-your-woocommerce-store) in the database.

## Replies

### Reply by Anonymous User

Hey Suresh,\
You can use cell_endedit event of datagridview to add automatically value in datagridview. You can take a look of following code snippet to perform this task.\
\

```
/// <summary>/// You can use cell end edit event to perform automatic insertion of value./// </summary>private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e){    //Suppose that column index is 3 where you want to insert datetime    //value automatically.    if (e.RowIndex > -1 && e.ColumnIndex == 3)    {//This condition will insure correct cell is clicked.                 //dataGridView1[3, e.RowIndex] will represent modified cell.                dataGridView1[3, e.RowIndex].Value = DateTime.Now;    }}
```

Thanks.

### Reply by suresh g

Hi.... John Smith\
I am working with windows grid [view](https://yourviews.mindstick.com/view/84701/layoffs-in-google-india-2023-view) with in that i have five columns are there those names are(Select(check box), Slno, ID, [Name](https://yourviews.mindstick.com/view/87450/how-to-generate-a-brand-name-using-linkedin-comprehensive-guide), Date) with in that i have six buttons are there those are(ADD,DELETE,UPDATE,TODAY,MONTH, SHOW ALL)when i will going to insert the record ID, Name fields are able to enter Date, Slno are automatically enter with press tab key.if i click on ADD records are inserted into data base(one are more records depends up on inserting). if i click on DELETE only checked records will be deleted.if i click on TODAY button depending on date [column](https://www.mindstick.com/forum/33860/how-to-calculate-column-summary-in-sql-server) only today records will be show in the grid view.if i click on MONTH button ask one message enter month, then the month records will be display.these are my requirement please help me. if possible give me your mail id i will send the sample grid view. my id: suri1319@gmail.com

### Reply by John Smith

I am unable to understand you question properly...please try to explain your question..\
If you talking about ( the date time should be inserted automatically in the database then for that you can use trigger in database)\
\
http://mindstick.com/Articles/d9d0f625-6146-415b-b286-3319e3ec336f/?Trigger%20in%20SQL%20server\
\
http://www.mindstick.com/Articles/f7074849-0e9e-463b-a12d-f3d7a35b2785/?Trigger%20in%20SQL%20Server\
\
http://mindstick.com/Articles/8a50890e-16b5-4fc6-8970-54ae61a898f9/?Triggers%20in%20SQL%20Server


---

Original Source: https://www.mindstick.com/forum/372/automatic-time-display-in-grid-view-column

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
