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

Toggle Date and Time Controls to popup at the same time

5 Answers 69 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
sunday oke
Top achievements
Rank 1
sunday oke asked on 18 Apr 2011, 11:02 AM
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

5 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 21 Apr 2011, 12:13 PM
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.

0
sunday oke
Top achievements
Rank 1
answered on 28 Apr 2011, 11:36 AM
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

0
Radoslav
Telerik team
answered on 03 May 2011, 08:25 AM
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.

0
sukumarg
Top achievements
Rank 1
answered on 10 Sep 2012, 04:06 PM
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

0
Radoslav
Telerik team
answered on 13 Sep 2012, 07:06 AM
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.
Tags
Calendar
Asked by
sunday oke
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
sunday oke
Top achievements
Rank 1
sukumarg
Top achievements
Rank 1
Share this question
or