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

Use of Datepicker & Timepicker within RadGrid

9 Answers 615 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Adigard
Top achievements
Rank 1
Adigard asked on 06 Oct 2011, 03:15 PM
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 !

9 Answers, 1 is accepted

Sort by
0
Gimmik
Top achievements
Rank 1
answered on 06 Oct 2011, 10:23 PM
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
0
Adigard
Top achievements
Rank 1
answered on 06 Oct 2011, 10:37 PM
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!
0
Gimmik
Top achievements
Rank 1
answered on 06 Oct 2011, 10:46 PM
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.
0
Adigard
Top achievements
Rank 1
answered on 06 Oct 2011, 11:04 PM
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!
0
Gimmik
Top achievements
Rank 1
answered on 07 Oct 2011, 03:47 AM
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.
0
Gimmik
Top achievements
Rank 1
answered on 07 Oct 2011, 03:55 AM
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
0
Adigard
Top achievements
Rank 1
answered on 07 Oct 2011, 09:12 AM
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 ...
0
Accepted
Gimmik
Top achievements
Rank 1
answered on 07 Oct 2011, 03:31 PM
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>
0
Adigard
Top achievements
Rank 1
answered on 07 Oct 2011, 03:32 PM
Yep , it's working!
thanks a lot
Tags
Grid
Asked by
Adigard
Top achievements
Rank 1
Answers by
Gimmik
Top achievements
Rank 1
Adigard
Top achievements
Rank 1
Share this question
or