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

[Solved] When editing, DateTime column gets blanked

1 Answer 11 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Shea
Top achievements
Rank 1
Shea asked on 24 Feb 2012, 09:23 PM
Consider the model:
public class
{
        public long PaymentId { get; set; }
        public decimal Amount { get; set; }
        public DateTime Date { get; set; }
}
My columns are set up like so:
cols.Bound(p => p.PaymentId).Hidden();
cols.Bound(p => p.Date).Format("{0: dd MMM yyyy}");
cols.Bound(p => p.Amount);
 
cols.Command(cmds =>
{
    cmds.Edit();
    cmds.Delete();
});

The problem is when the edit button is clicked, the date value gets blanked. The amount remains and is editable. When I insert a new item, the date column defaults to todays date which is great.  But when I edit a payment, the date gets blanked, so if you change the value of amount, and hit 'update' an error is thrown, because date is now emtpy.

Is this a known bug?

1 Answer, 1 is accepted

Sort by
0
Shea
Top achievements
Rank 1
answered on 24 Feb 2012, 09:50 PM
I found the solution.  the space before the 'dd' in my format string was the culprit. Not sure if this is my bug, or Telerik's.

~S
Tags
Grid
Asked by
Shea
Top achievements
Rank 1
Answers by
Shea
Top achievements
Rank 1
Share this question
or