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

[Solved] DatePicker in Filter

2 Answers 191 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Airad
Top achievements
Rank 1
Airad asked on 27 Jul 2009, 09:52 AM
Hi!

I have a DatePicker to filter in grid:

<telerik:GridDateTimeColumn  DataField="JoiningDate" HeaderText="JoiningDate" SortExpression="JoiningDate" UniqueName="JoiningDate" PickerType="DatePicker" DataFormatString="{0:yyyy-MM--dd}" ></telerik:GridDateTimeColumn> 

So how to make the DatePicker  into same format "{0:yyyy-MM--dd}" ?

situation like this:

JoiningDate 
-----------------------------
1/3/2007  (Filter here, selected date)
-----------------------------
2008-01-31
2008-10-01 
2008-01-01


Thanks!

Best Regards
Airad

2 Answers, 1 is accepted

Sort by
0
Accepted
Pavlina
Telerik team
answered on 28 Jul 2009, 05:31 PM
Hi Airad,

Attached to this message is a simple working project that demonstrates the needed approach . Please give it a try and see if it works for you.

Regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Airad
Top achievements
Rank 1
answered on 30 Jul 2009, 02:27 AM
Hi!

:)  We've solve the problem in this way:

protected void Page_Load(object sender, EventArgs e)  
        {  
            CultureInfo cult = (CultureInfo)    
            Thread.CurrentThread.CurrentCulture.Clone();  
            cult.DateTimeFormat.DateSeparator = "-";  
            cult.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd";  
            Thread.CurrentThread.CurrentCulture = cult;    
        } 

Beacuse we haven't a <telerik:RadDatePicker> but a <telerik:GridDateTimeColumn  PickerType="DatePicker"> here to filter. This DatePicker is automatically in grid column filter, and this GridColumn is not a template column. We can't put a <DateInput DateFormat="yyyy-MM-dd"> into it,  so we format date in pageload.

In fact, it's not a DatePicker created from <telerik:RadDatePicker>, my tiltle causes misunderstanding.

Thanks!

Best Regards
Airad
Tags
Grid
Asked by
Airad
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Airad
Top achievements
Rank 1
Share this question
or