automatic time display in grid view column

Total Post:3


 2291  View(s)
Rate this:
in grid view one column name is date/time. when we will insert the record through grid view the date/time record will automatically store in the database.
  1. Re: automatic time display in grid view column

    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)

  1. Re: automatic time display in grid view column

    Hi.... John Smith

    I am working with windows grid view with in that i have five columns are there those names are(Select(check box), Slno, ID, Name, 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 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:

      Modified On Dec-29-2011 12:07:02 AM
  1. Re: automatic time display in grid view column

    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;


      Modified On Mar-29-2018 05:00:55 AM


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.