Hello ,
GridDateTimeColumn Filter template do not highlight today date.
I want to highlight today date when filter Datepicker open.
As i have already developed the application and i have used the datepicker filter control in more than 100 place so please provide me the global solution.
See the attached demo screenshot.
http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/filtering/defaultcs.aspx
GridDateTimeColumn Filter template do not highlight today date.
I want to highlight today date when filter Datepicker open.
As i have already developed the application and i have used the datepicker filter control in more than 100 place so please provide me the global solution.
See the attached demo screenshot.
http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/filtering/defaultcs.aspx
5 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 10 Sep 2013, 09:38 AM
Hi Hiren,
Please try the below code snippet to highlight today's date when filtering.
C#:
Thanks,
Princy
Please try the below code snippet to highlight today's date when filtering.
C#:
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridFilteringItem)
{
foreach
(GridColumn col
in
RadGrid1.Columns)
{
if
(col.ColumnType ==
"GridDateTimeColumn"
)
{
GridFilteringItem filteringItem = (GridFilteringItem)e.Item;
RadDatePicker datepicker = (RadDatePicker)filteringItem[col.UniqueName].Controls[0];
RadCalendarDay NewDay =
new
RadCalendarDay();
NewDay.Repeatable = RecurringEvents.Today;
NewDay.ItemStyle.BackColor = System.Drawing.Color.Red;
datepicker.SharedCalendar.SpecialDays.Add(NewDay);
}
}
}
}
Thanks,
Princy
0
Hiren
Top achievements
Rank 1
answered on 10 Sep 2013, 09:49 AM
Hello Princy,
Thanks for your reply but unfortunately your solution is not feasible because i need to change in 100 of places
I required global solution. either on CSS or Javascript
Thanks,
Thanks for your reply but unfortunately your solution is not feasible because i need to change in 100 of places
I required global solution. either on CSS or Javascript
Thanks,
0
Hi Hiren,
You can use ControlAdapter in your site, that to affects all RadCalendars. In the adapter you can override the load of the control and add the special day.
JavaScript solution will be possible, but will require more scripting, and will be slower in executing in the browser. You can do it by overriding the Telerik.Web.UI.RadCalendar.prototype.initialize. But generally I wouldn't recommend this,
Note that there will be difference between the server and client approach. For example the server can be in different time zone, which means that today in server is tomorrow or yesterday in client.
Also if the clock on the client machine is wrong, it will see wrong highlighted date with the JavaScript approach and correct with the server side approach.
Regards,
Vasil
Telerik
You can use ControlAdapter in your site, that to affects all RadCalendars. In the adapter you can override the load of the control and add the special day.
JavaScript solution will be possible, but will require more scripting, and will be slower in executing in the browser. You can do it by overriding the Telerik.Web.UI.RadCalendar.prototype.initialize. But generally I wouldn't recommend this,
Note that there will be difference between the server and client approach. For example the server can be in different time zone, which means that today in server is tomorrow or yesterday in client.
Also if the clock on the client machine is wrong, it will see wrong highlighted date with the JavaScript approach and correct with the server side approach.
Regards,
Vasil
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Hiren
Top achievements
Rank 1
answered on 12 Sep 2013, 09:17 AM
Hello Vasil,
Thanks for your reply.
I do not know how to used the ControlAdapter can you help me to implement this. and when we use ControlAdapter does it required to changes in every places and also my RadCalendars will works except the filter control templates also ?
For telerik datepicker highlight the today date but while i use the Datepicker in filter control template then why it not automatically highlight ?
Thanks,
Hiren
Thanks for your reply.
I do not know how to used the ControlAdapter can you help me to implement this. and when we use ControlAdapter does it required to changes in every places and also my RadCalendars will works except the filter control templates also ?
For telerik datepicker highlight the today date but while i use the Datepicker in filter control template then why it not automatically highlight ?
Thanks,
Hiren
0
Accepted
Hi Hiren,
I am attaching an example of ControlAdapter that to apply style for the current day in all calendars of your page. It will work for dynamically added as well, and you don't need to change any existing code.
Regards,
Vasil
Telerik
I am attaching an example of ControlAdapter that to apply style for the current day in all calendars of your page. It will work for dynamically added as well, and you don't need to change any existing code.
Regards,
Vasil
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.