Hi Team,
I have RadGrid which is populated via NeedDataSource Event.. In the grid, One of the column is DateTimeColumn.. Now, I want to add Date And Time Filter for this column.. So, I set the PickerType to DateTimePicker.. Now, It shows date control and time control.. But, when I select the time control it shows only hours and minutes.. whereas we need hour, minutes and seconds also should be shown.. Please let me know how to achieve this...
Thanks,
Prakash..
7 Answers, 1 is accepted
In order to achieve this scenario you can obtain a reference to the filter box of the column in the ItemCreated event, and set the DateFormat mask for the date input control:
protected
void
RadGrid1_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridFilteringItem)
{
RadDateTimePicker picker = ((GridFilteringItem)e.Item)[
"DateTimeColumn"
].Controls[0]
as
RadDateTimePicker;
if
(picker !=
null
)
{
picker.DateInput.DateFormat =
"M/d/yyyy hh:mm:ss"
;
}
}
}
Regards,
Maria Ilieva
Telerik

Hi
The solution didn't work for me..
The column details which I used is below,
Please let me know,
1. How to the show the seconds in the time ticker
2. Filtering the records based on Date and Time
<telerik:GridDateTimeColumn
EnableTimeIndependentFiltering="true" PickerType="DateTimePicker"
DataFormatString="{0:MM/dd/yyyy hh:mm:ss}"
FilterDateFormat="{0:MM/dd/yyyy hh:mm:ss}"
HeaderText="Deleted Date"
DataType="System.DateTime"
DataField="DeletedOn"
FilterControlWidth="75%"
UniqueName="DeletedOn"
FilterControlAltText="Filter DeletedOnColumn">
</telerik:GridDateTimeColumn>
Thanks In Advance,
Prakash.
Тry using template column with DateTimePicker in it and add the following settings to the picker:
<
telerik:RadDateTimePicker
ID
=
"RadDateTimePicker1"
ZIndex
=
"30001"
runat
=
"server"
DbSelectedDate='<%# Bind("StartTime", "{0:T}") %>'>
<
TimeView
runat
=
"server"
TimeFormat
=
"HH:mm:ss"
>
</
TimeView
>
<
DateInput
ID
=
"DateInput1"
runat
=
"server"
DateFormat
=
"MM/dd/yyyy hh:mm:ss"
DisplayDateFormat
=
"MM/dd/yyyy hh:mm:ss"
>
</
DateInput
>
</
telerik:RadDateTimePicker
>
Regards,
Maria Ilieva
Telerik

Seems there was misunderstanding I guess..
I have GridDateTimeColumn and values is DateTime value.. I'm able to display the value with Date and Time..
Now, My requirement is I need to add filter with both date and time option..
By default it shows the Date Picker.. If I change the Picker Type to DateTime, it shows both Date and Time picker.. But the problem, the time picker shows only hour and minute.. but I want hour, minute and seconds should be selected from the Time Picker.. so that it filters the value based on date and time..
To add more.. my input values 07/01/2015 04:44:32, 07/06/2015 06:33:55..
Now I want to filter the value with both Date and Time (hh:mm:ss)
Please guide with proper inputs as early as possible..
Thanks In Advance..
In this case the correct approach here is to set a FilterDateFormat string so that the time part (including the seconds) of the date does not get escaped. Attached is a sample example that demonstrates this approach.
It is not possible to add Seconds in the TimeView of the TimePicker control however you can manually modify the seconds in the filter filed.
Regards,
Maria Ilieva
Telerik

Thanks Maria..
I tried your solution but I didn't shows the seconds in the filter.. Please refer the image(Filter.jpg).. This is the result of the example..
but I want seconds also should be displayed in the timer.. Please refer the image (ExpectedFilterTimer.jpg).. This is what I want..
Please let me know how to do that..
Thanks In Advance..
Try setting TimeFormt for the filter item like this:
protected
void
RadGrid1_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridFilteringItem)
{
GridFilteringItem filteringItem = e.Item
as
GridFilteringItem;
RadDateTimePicker picker = filteringItem[
"Date"
].Controls[0]
as
RadDateTimePicker;
picker.SharedTimeView.TimeFormat =
"HH:mm:ss"
;
picker.SharedTimeView.Interval =
new
TimeSpan(0, 45, 0);
}
}
Regards,
Maria Ilieva
Telerik