I have a gridview with 3 columns, only one column is going to be edited by the user. Whenever it is edited I’d like to set one of the other columns to the current time. A “time last updated” if you will. Possible?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Andy’s solution works.
Another method would be to alter the UPDATE sql statement that is associated with the grid. Use GetDate() (or your DB equivalent) in the UPDATE statement like so:
UPDATE MyTable SET usereditvalue = @usereditvalue, mytimestamp = GETDATE()
Optionally with a Where statement:
WHERE MyTable.ID = @oldIDvalue
For doing it this way, read up on parameterized queries and gridview / table keyvalues (for your WHERE statement).