Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • TaoistTotty 246 posts 314 karma points
    Apr 24, 2011 @ 18:40
    TaoistTotty
    0

    Using Umbraco Date Time Picker in ASCX file

    I know this is probably a simple question but is there anyway of using the Umbraco Date Time Picker in an ascx control?

    Many thanks

    TT

  • Eran Meir 401 posts 543 karma points
    Apr 24, 2011 @ 19:38
  • TaoistTotty 246 posts 314 karma points
    Apr 24, 2011 @ 19:44
    TaoistTotty
    0

    Many thanks for the suggestion Eran, I will give this a go.

    Regards

    TT

  • Richard Soeteman 4054 posts 12927 karma points MVP 2x
    Apr 26, 2011 @ 09:16
    Richard Soeteman
    1

    Hi,

    You can use the default Umbraco control.Add a reference to EditorControls dll and create an usercontrol

    Declare the following namespace

    using umbraco.uicontrols.DatePicker;

    override the OnInit method to add the control

     protected override void OnInit(EventArgs e)
            {
                base.OnInit(e);

    DateTimePicker dateValuePicker = new DateTimePicker();

    Controls.Add(dateValuePicker);

    }

    Hope this helps you,

    Richard

     

  • TaoistTotty 246 posts 314 karma points
    May 01, 2011 @ 21:46
    TaoistTotty
    0

    Many thanks Richard this worked.

    Regards

    TT

  • Greg Berlin 818 posts 634 karma points
    Oct 08, 2012 @ 03:23
    Greg Berlin
    0

    Hey Richard... do you know if this approach can be used to create a custom control for a custom data type (i want to add a date picker to a custom control with a couple of other options)?  Any suggestions of the best way to achieve this?

  • Richard Soeteman 4054 posts 12927 karma points MVP 2x
    Oct 08, 2012 @ 07:23
    Richard Soeteman
    0

    Hi Greg,

    Yes works also, exactly the same as you use it in a User Control. Just override the oninit method.

    Hope that helps,

    Richard

  • Greg Berlin 818 posts 634 karma points
    Oct 08, 2012 @ 18:01
    Greg Berlin
    0

    You're right i got it working Richard... however I need the source code as I need to make a control with a date picker as well as some other fields, and they need to be able to interact with each other.  Think I'm going to outsource this one as I dont have time to figure it out myself right now :(

    http://our.umbraco.org/forum/jobs/jobs/35153-Need-a-DataType-Built

    THanks for the info..

  • Nigel Wilson 945 posts 2077 karma points
    Oct 09, 2012 @ 05:10
    Nigel Wilson
    0

    Hi there

    Sorry to reactivate an old post but is someone able to expand on Richards' post.

    The bit I am missing is how, after adding the code detailed, do you get a datepicker appearing on the page within your user control.

    As background - I am wanting to add a custom user control as a dashboard item with 2 date pickers (date from, date to).

    Thanks

    Nigel

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

    Continue discussion

Please Sign in or register to post replies