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

How to set DatePicker Calendar attributes used in radgrid (inline) edit

5 Answers 233 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ruud
Top achievements
Rank 1
Ruud asked on 23 Jun 2010, 03:11 PM
Hello,

I need to set the calendar tooltips (to Dutch) of a DataPicker. The DataPicker is used within in an RadGrid.
I can set the attributes of the textbox, but I cannot set the attributes of the calendar control, that is, I can set them, but they are not used, the application shows the default values.

This is the relevant part of the aspx:
<!-- snapshot from the RadGrid --> 
 
<telerik:GridDateTimeColumn   
    DataField="Gebdatum" HeaderText="Geboorte datum" UniqueName="Gebdat" > 
</telerik:GridDateTimeColumn> 
 
 
And this is the code behind:

Protected Sub FormatieRadGrid_ItemCreated(ByVal sender As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) Handles FormatieRadGrid.ItemCreated  
 
    If (TypeOf e.Item Is Telerik.Web.UI.GridEditableItem AndAlso e.Item.IsInEditMode) Then 
 
        'This is working  
        Dim gebdat As Telerik.Web.UI.RadDatePicker = CType(CType(e.Item, Telerik.Web.UI.GridEditableItem)("Gebdat").Controls(0), Telerik.Web.UI.RadDatePicker)  
        gebdat.Width = 80  
        gebdat.tooltip = "geboorte datum" 
        gebdat.EnableTyping = False 
 
        'This does work as it gives no exceptions, but the code seems to be ignored   
        Dim cal As Telerik.Web.UI.RadCalendar = CType(gebdat.FindControl("calendar"), Telerik.Web.UI.RadCalendar)  
        cal.ToolTip = "Toon kalender popup" 
        cal.FastNavigationSettings.EnableTodayButtonSelection = False 
        cal.FastNavigationStep = 12  
        cal.FastNavigationNextToolTip = "volgend jaar" 
        cal.FastNavigationPrevToolTip = "vorig jaar" 
        cal.NavigationNextToolTip = "volgende maand" 
        cal.NavigationPrevToolTip = "vorige maand" 
        'The calendar control still shows its defaults values in stead of the adapted ones    
 
    End If 
      
End Sub 
 
 
What am I doing wrong / why doesn't this work as expected?

Regards,
-Ruud.

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Jun 2010, 10:31 AM
Hello Ruud,

You can try the following code snippet to set properties for embedded calendar control of RadDatePicker.

VB.NET:

 Protected
 Sub RadGrid1_ItemCreated(sender As Object, e As GridItemEventArgs) 
    If (TypeOf e.Item Is Telerik.Web.UI.GridEditableItem AndAlso e.Item.IsInEditMode) Then 
        Dim gebdat As Telerik.Web.UI.RadDatePicker = DirectCast(DirectCast(e.Item("Gebdat").Controls(0), Telerik.Web.UI.GridEditableItem), Telerik.Web.UI.RadDatePicker) 
        gebdat.Width = 80 
        gebdat.tooltip = "geboorte datum" 
        gebdat.EnableTyping = False 
 
        gebdat.SharedCalendar.ToolTip = "Toon kalender popup" 
        gebdat.SharedCalendar.FastNavigationSettings.EnableTodayButtonSelection = False 
        gebdat.SharedCalendar.FastNavigationStep = 12 
        gebdat.SharedCalendar.FastNavigationNextToolTip = "volgend jaar" 
        gebdat.SharedCalendar.FastNavigationPrevToolTip = "vorig jaar" 
        gebdat.SharedCalendar.NavigationNextToolTip = "volgende maand" 
        gebdat.SharedCalendar.NavigationPrevToolTip = "vorige maand" 
    End If 
 End Sub 
 

Thanks,
Princy.
0
Ruud
Top achievements
Rank 1
answered on 24 Jun 2010, 02:02 PM
Hello Princy,

Thanks for the quick reply,  odd enough for these attribs it works:

gebdat.SharedCalendar.FastNavigationStep = 12 
gebdat.SharedCalendar.FastNavigationNextToolTip = "volgend jaar" 
gebdat.SharedCalendar.FastNavigationPrevToolTip = "vorig jaar" 
gebdat.SharedCalendar.NavigationNextToolTip = "volgende maand" 
gebdat.SharedCalendar.NavigationPrevToolTip = "vorige maand" 

but not for these:
gebdat.SharedCalendar.ToolTip = "Toon kalender popup" 
gebdat.SharedCalendar.FastNavigationSettings.EnableTodayButtonSelection = False 

any idea why?
0
Radoslav
Telerik team
answered on 30 Jun 2010, 08:59 AM
Hi Ruud,

Could you please elaborate a bit more on the described issue about the gebdat.SharedCalendar.FastNavigationSettings.EnableTodayButtonSelection = False.  In your side, what is happen when you click on the Today button? The EnableTodayButtonSelection gets or sets the value indicating whether the Today button should perform date selection or simple navigation.  So if this property is set to false and user clicks on the Today button the calendar will shows the view with the current month without selecting the current date. I tested this property and it works correct.

Kind regards,
Radoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ruud
Top achievements
Rank 1
answered on 30 Jun 2010, 11:23 AM

I was on the assumption that the today button would disappear but it behaves as you explained.
Is there a way to remove that button, since, in our application, it does not make sense to set the birthday on today (It handles about wages). If not, is it possible to change the text (because our client insist on having all text in Dutch)  

Regards,
-Ruud.

0
Accepted
Radoslav
Telerik team
answered on 02 Jul 2010, 11:31 AM
Hello Ruud,

You could hide the Today button with the following css:
<style type="text/css">
#rcMView_Today
{
    display: none;
}
</style>

Additionally you could change the Today button's text by setting the different value to the RadDatePicker.Calendar.FastNavigationSettings.TodayButtonCaption property.

I hope this helps.

All the best,
Radoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Ruud
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ruud
Top achievements
Rank 1
Radoslav
Telerik team
Share this question
or