Setting datatype of column with code behind

4 posts, 0 answers
  1. Cameron Molyneux
    Cameron Molyneux avatar
    79 posts
    Member since:
    Jan 2010

    Posted 27 May 2010 Link to this post

    I'm trying to set the data type of one of my columns  with code behind using the following code but it is erroring

    Can anyone explain what i'm doing wrong?

    column.DataType = typeof(DateTime);



  2. Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 27 May 2010 Link to this post

    Hello Cameron Molyneux,

     Could you share a bit more information about your scenario? What is the incoming data's type, what is the error you're getting, etc.

    Sincerely yours,
    Yavor Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Cameron Molyneux
    Cameron Molyneux avatar
    79 posts
    Member since:
    Jan 2010

    Posted 27 May 2010 Link to this post

    Unfortunately its a bit rubbish!!

    we call a service and get a dataset returned .. all the columns are typed as string

    i was hoping that the string would automatically cast as a date if we typed the column as a date

    the date format is 27/05/2010 for example

    the issue i'm having is when we try and sort by the column .. as it is it doesnt sort as a date would
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 27 May 2010 Link to this post

    Hello,

    Casting one type to other will not convert anything. You need to create DateTime from this string to achieve your goal.

    Kind regards,
    Vlad
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top