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

RadDatePicker and Context menu

5 Answers 92 Views
Input
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 1
Randy asked on 01 Aug 2012, 01:21 AM
Is it Possible to attach a RadContextMenu to A RadDatePicker Control?  And if So Is there any code examples?

Thanks

---R

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 01 Aug 2012, 05:30 AM
Hi Randy,

Here is the sample code that I tried to achieve your scenario.

ASPX:
<telerik:RadDatePicker ID="RadDatePicker1" runat="server">
</telerik:RadDatePicker>
<telerik:RadContextMenu ID="RadContextMenu1" runat="server">
  <Targets>
     <telerik:ContextMenuElementTarget ElementID="RadDatePicker1_dateInput" />
  </Targets>
  <Items>
     <telerik:RadMenuItem Text="RadMenuItem1">
     </telerik:RadMenuItem>
     <telerik:RadMenuItem Text="RadMenuItem2">
     </telerik:RadMenuItem>
     <telerik:RadMenuItem Text="RadMenuItem3">
     </telerik:RadMenuItem>
  </Items>
</telerik:RadContextMenu>

Hope this helps,

Regards,
Princy.
0
swegele
Top achievements
Rank 1
answered on 07 Apr 2016, 05:53 PM

Princy,  I tried your example and it does not work...brings up the browsers default context menu.  Using latest telerik asp.net ajax version.  Any other tips?
Tried both techniques:

<telerik:ContextMenuElementTarget ElementID="RadDatePickerDOB_dateInput" />
<telerik:ContextMenuControlTarget ControlID="RadDatePickerDOB" />

0
Viktor Tachev
Telerik team
answered on 08 Apr 2016, 10:39 AM
Hi,

I tested the code and it is working as expected on my end. Check out the sample video below as illustration.


Let me know if I am missing something. In case the behavior persists please send us your markup code so we can examine it.

Regards,
Viktor Tachev
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
swegele
Top achievements
Rank 1
answered on 08 Apr 2016, 11:37 PM

I think maybe the difference is my aspx code is running in a master page and thus the control name client id is pre-pended with the Content tag?

Can you try it with a master page?

I was able to get it to work by doing it in the OnClientLoaded event in javascript.

Thanks,

0
Viktor Tachev
Telerik team
answered on 13 Apr 2016, 08:32 AM
Hi,

If you are using Master/Content pages it is expected that the context menu is not displayed with the setup. In order to have the context menu work as expected in that scenario you can use the approach you have implemented.

Alternatively you can use the server-side Load event of the RadContextMenu control and add the ClientID of the DateInput to the Targets collection.

Regards,
Viktor Tachev
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Input
Asked by
Randy
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
swegele
Top achievements
Rank 1
Viktor Tachev
Telerik team
Share this question
or