RadDatePicker and Context menu

6 posts, 0 answers
  1. Randy
    Randy avatar
    2 posts
    Member since:
    Dec 2010

    Posted 31 Jul 2012 Link to this post

    Is it Possible to attach a RadContextMenu to A RadDatePicker Control?  And if So Is there any code examples?

    Thanks

    ---R
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 01 Aug 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. swegele
    swegele avatar
    20 posts
    Member since:
    Apr 2007

    Posted 07 Apr in reply to Princy Link to this post

    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" />

  5. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 08 Apr Link to this post

    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.
  6. swegele
    swegele avatar
    20 posts
    Member since:
    Apr 2007

    Posted 08 Apr in reply to Viktor Tachev Link to this post

    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,

  7. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 13 Apr Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017