Do you know how I can insert date in gridview after checkbox is checked?

Greetings mates,

We have checkbox in gridview where a user can check one or more boxes.

What we would like to do is to show current date for any and all checkbox(es) checked.

Can someone please help with inserting dates into gridview after a checkbox is checked or checkboxes are checked?

Here is what I have:




        For Each c As GridViewRow In gridView1.Rows
            If CType(c.Cells(0).FindControl("myrec"), CheckBox).Checked Then

                '******Need to insert today's date here whenever a checkbox is checked*****                       

End If
        Next

Open in new window


Thanks a lot in advance.
LVL 29
sammySeltzerAsked:
Who is Participating?
 
CodeCruiserConnect With a Mentor Commented:
May be

c.Cells(1).value = Now.Today.ToString("dd/MM/yyyy")

assuming you want date in 2nd column.
0
 
Obadiah ChristopherConnect With a Mentor Commented:
Is it a textbox that you want to insert in?

DateTime.Now.ToString("dd/MM/yyyy")
0
 
sammySeltzerAuthor Commented:
Well, it doesn't really matter if I use TextBox or label.

What is important is that I want this date inserted only AFTER a checkbox is checked.

In other words, if no checkboxes are checked, the date column should be blank.

Hope this is clearer.

Thanks
0
 
sammySeltzerAuthor Commented:
Sorry for late response on this but I have since resolved it.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.