Use of Datepicker & Timepicker within RadGrid

10 posts, 1 answers
  1. Adigard
    Adigard avatar
    61 posts
    Member since:
    Oct 2011

    Posted 06 Oct 2011 Link to this post

    Greetings all,

    I have been using Datepicker & Timepicker from Jquery for some months but since Telerik provides the same controls i would like to know how i could implement both in a Radgrid while trying to add a row.

    I have a field which expect to get a date and a field a time.

    I would like, as JQuery proposed, to be able to pick the date/time when i click on the  textbox.

    thanks for the help !
  2. Gimmik
    Gimmik avatar
    170 posts
    Member since:
    May 2011

    Posted 06 Oct 2011 Link to this post

    Hey Rambert,

    You can use a GridDateTimeColumn for that. It will appear as a Date/Time in view mode, and a Date/Time picker in edit mode. Check out the other cool column types Telerik has.

    http://www.telerik.com/help/aspnet-ajax/grid-column-types.html
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Adigard
    Adigard avatar
    61 posts
    Member since:
    Oct 2011

    Posted 06 Oct 2011 Link to this post

    Hello
    thank you for your answer.

    Actually i do have a dateTime field in my Datasource, therefore if i'm right, the only thing i have to do is to put a DatePicker control on the form and it will be automaticaly detected when i click on my textbox?
    thank you!
  5. Gimmik
    Gimmik avatar
    170 posts
    Member since:
    May 2011

    Posted 06 Oct 2011 Link to this post

    If you're using AutoGenerateColumns the RadGrid should detect the data type is a DateTime and create the correct column type. If you're creating the column manually, you'll have to use the correct column type for the data you are binding it to.
  6. Adigard
    Adigard avatar
    61 posts
    Member since:
    Oct 2011

    Posted 06 Oct 2011 Link to this post

    Yes i'm using AutoGenerateColumns.
    Thank you for your answer

    So like you said my RadGrid should detect the datatype is a datatime. but do i need to place a RadPicker on the form or this will be detected without ?

    Nothing else to do ?
    thx!
  7. Gimmik
    Gimmik avatar
    170 posts
    Member since:
    May 2011

    Posted 06 Oct 2011 Link to this post

    I'm not sure why you would add a DateTimePicker to the webform, but if all you want to do is to use a DateTimePicker to choose dates or times for entries in the RadGrid, there is nothing else to do! Telerik makes this super easy for you.
  8. Gimmik
    Gimmik avatar
    170 posts
    Member since:
    May 2011

    Posted 06 Oct 2011 Link to this post

    I found a demo for you. This shows of what it should look like when you have a DateTime column in edit mode. Notice the icons to the right that can be used to select dates and times.

    http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/columntypes/defaultcs.aspx
  9. Adigard
    Adigard avatar
    61 posts
    Member since:
    Oct 2011

    Posted 07 Oct 2011 Link to this post

    Thank you for your help.

    I don't know where this problem comes from.

    I've just checked into " Open property builder" /master table/columns
    and i had confirmation the datatype of my dateTime column is System.DateTime.

    I don't know it does not show me the picker. need to investigate more ...
  10. Answer
    Gimmik
    Gimmik avatar
    170 posts
    Member since:
    May 2011

    Posted 07 Oct 2011 Link to this post

    When AutoGenerateColumns doesn't work for me I just create my columns manually, It's a little more advanced, but you have much more control. Try doing something like this:

    <telerik:RadGrid ID="RadGrid1" runat="server">
      <MasterTableView DataSourceID="OrdersDataSource">
        <Columns>
          <telerik:GridDateTimeColumn DataField="OrderDate" HeaderText="Order Date" UniqueName="OrderDate">
          </telerik:GridDateTimeColumn>
        </Columns>
      </MasterTableView>
    </telerik:RadGrid>
  11. Adigard
    Adigard avatar
    61 posts
    Member since:
    Oct 2011

    Posted 07 Oct 2011 Link to this post

    Yep , it's working!
    thanks a lot
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017