Toggle Date and Time Controls to popup at the same time

6 posts, 0 answers
  1. sunday oke
    sunday oke avatar
    2 posts
    Member since:
    Aug 2009

    Posted 18 Apr 2011 Link to this post

    Hello All

    I'm using the DateTime picker, and I would like to be able to click on either the date or time icon (or perhaps a different icon entirely) so that both the Date and Time Picker pop up at the same time and within the same frame

    Please see attached for example

    Many thanks
  2. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 21 Apr 2011 Link to this post

    Hello Sunday,

    Unfortunately the RadDateTimePicker does not support the desired functionality. However you could achieve it with some custom code and by overriding the showTimePopup function:

    <telerik:RadDateTimePicker runat="server" ID="RadDateTimePicker1">
    <TimePopupButton Visible="false" />
    <ClientEvents OnPopupOpening="showPopUpAbove" />
    </telerik:RadDateTimePicker>
    <telerik:RadCodeBlock runat="server">

    <script type="text/javascript">
        var flag = 0;
     
        function showPopUpAbove(sender, args)
        {
            if (flag == 0)
            {
                flag = 1;
     
                args.set_cancel(true);
     
                var picker = sender;
                var textBox = picker.get_textBox();
     
                var popupElement = null;
     
                if (picker.get_popupContainer())
                {
                    popupElement = picker.get_popupContainer();
                }
                else
                {
                    popupElement = picker.get_timePopupContainer();
                }
     
                var dimensions = picker.getElementDimensions(popupElement);
                var position = picker.getElementPosition(textBox);
                picker.showPopup();
                picker.showTimePopup(position.x + 200, position.y - dimensions.height + 200);
            }
            else
            {
                flag = 0;
            }
        }
     
        Telerik.Web.UI.RadDateTimePicker.prototype.showTimePopup = function (x, y)
        {
            this._setUpTimeView();
            if (this.isTimePopupVisible())
                return;
     
            this.get__TimePopup().ExcludeFromHiding = this.get__TimePopupVisibleControls();
            this.hideTimePopup();
     
            var args = new Telerik.Web.UI.DatePickerPopupOpeningEventArgs(this.get_timeView(), false);
            this.raise_popupOpening(args);
     
            if (args.get_cancel() == true)
            {
                return;
            }
     
            if (this.get_dateInput()._hiddenElement.value)
            {
                var rawTime = this.get_dateInput()._hiddenElement.value.split("-");
                this.get_timeView()._selectTimeCell(parseInt(rawTime[3], 10), parseInt(rawTime[4], 10));
            }
     
            if (this._animationSettings.HideAnimationDuration > 0)
                this.get_timeView()._clearHovers();
     
            this.get__TimePopup().Opener = this;
            this.get__TimePopup().Show(x, y, this.get_timePopupContainer());
        }
     
    </script>

    Additionally please note that this is not a supported scenario.

    Best wishes,
    Radoslav
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. sunday oke
    sunday oke avatar
    2 posts
    Member since:
    Aug 2009

    Posted 28 Apr 2011 Link to this post

    Hello there

    Thank you very much for our help.

    I have tried the solution you offered, and I keep getting 'Telerik is not defined' at the

     

    'Telerik.Web.UI.RadDateTimePicker.prototype.showTimePopup ...' line.

    I have trawlled through loads of articles on the net, but no solution yet

    Many thanks

  5. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 03 May 2011 Link to this post

    Hello Sunday,

    I am sending you a simple example based on the provided code snippet. Please check it out and let me know what differs in your case.

    Looking forward for your reply.

    Regards,
    Radoslav
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  6. sukumarg
    sukumarg avatar
    1 posts
    Member since:
    Sep 2012

    Posted 10 Sep 2012 Link to this post

    Hi,

     its working fine but when i try add visual webpart i am getting error framework confilicts error (4.0 and 3.5) 
    i am using visual studio 2010 with sharepoint 2010

    Warning 37 The primary reference "Telerik.Web.UI" could not be resolved because it has an indirect dependency on the framework assembly "System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5". To resolve this problem, either remove the reference "Telerik.Web.UI" or retarget your application to a framework version which contains "System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". EServicesForm

  7. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 13 Sep 2012 Link to this post

    Hi Sukumarg,

    This discrepancy would normally occur if there is a mismatch between the TargetFramework version of your project and the assemblies it references. Is there a chance you might be using Telerik.Web.UI.dll for 4.0 assemblies in a application build on 3.5 framework? Could you please try adding Telerik.Web.UI.dll for .NET 3.5 into your project and let me know if the issue still persist.

    If that is not the case, could you send us a repro sample so that we can investigate the issue?

    Regards,
    Radoslav
    the Telerik team
    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 their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017