This is a migrated thread and some comments may be shown as answers.

[Solved] Save today's date when new record created

1 Answer 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Clive Hoggar
Top achievements
Rank 1
Clive Hoggar asked on 03 Sep 2009, 03:13 PM
Hi

I frequently use RadGrid in the automated edit, delete and  'Add New Record' mode as a very quick
solution to input and edit of data.

However I have not found a clean way of saving today's date in my DateCreated field when a new record is
created using the 'Add New Record' command button, other than a separate database update function after the
RadGrid has saved the other data. This seem to be making what should be a simple job, complex.

Can you tell me how best to do this either declaratively or in code behind in the appropriate RadGrid event.

Thanks a lot for your expertise!

Clive

1 Answer, 1 is accepted

Sort by
0
Mr. Plinko
Top achievements
Rank 1
answered on 03 Sep 2009, 06:10 PM
there are a couple ways I can think of:

  1. Create your own edit template and bind in the input to a raddatepicker that you use javascript to bind to today
  2. set the default date in the datasources asp:parameter to today
  3. Change your database to set the default value of your DateCreated field to today
  4. Run a code behind OnItemInserted that updates the field (which might be what you are doing already)

I was trying to play with method 2, but it was giving me issues.

I personally like to create my own edit templates, and that (for me) would be the easiest way to set the date to today

Perhaps someone else can give you a code example
Tags
Grid
Asked by
Clive Hoggar
Top achievements
Rank 1
Answers by
Mr. Plinko
Top achievements
Rank 1
Share this question
or