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

[Solved] Grid inline edit Date Column

2 Answers 98 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.
Howard
Top achievements
Rank 1
Howard asked on 09 Dec 2011, 02:16 AM
Dear Telerik Team,

I've a grid with inline editing. I need to put a datepicker in one of the columns, but the actual date data is stored in database as a string in "yyyyMMdd" format. I've looked into demo of ajax editing here, but it needs date as a actual datetime datatype. is there a way I can use date as string and still get the functionality?

Thank you

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 12 Dec 2011, 02:17 PM
Hello Niroj,

The field should be of DateTime type to use the DatePicker in edit mode. In order to use a  DatePicker 
in your scenario, you could use a ViewModel to convert the strings to valid dates. For example:

class Order {
        public string Date;
}
 
class OrderViewModel {
        public DateTime Date;
}
 
var orders = from o in GetOrders()
               select new OrderViewModel {
                      Date = Convert.ToDateTime(o.Date);
               }

Greetings,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Howard
Top achievements
Rank 1
answered on 14 Dec 2011, 06:23 AM
Thanks Daniel, genius !!!
Tags
Grid
Asked by
Howard
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Howard
Top achievements
Rank 1
Share this question
or