Copied to clipboard

Flag this post as spam?

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


  • Ron G 41 posts 137 karma points
    Oct 10, 2010 @ 21:23
    Ron G
    0

    Custom Section Edit Page - Using a DataTimePicker

    I'm trying to include a dateTimePicker on my custom edit page. I am able to get it working using:

    <%@ Page Language="C#" MasterPageFile="~/umbraco/masterpages/umbracoPage.Master" AutoEventWireup="true" CodeBehind="editCustom.aspx.cs" Inherits="UmbracoCustomTest.editCustom" %>
    <%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
    <%@ Register TagPrefix="cc2" Namespace="umbraco.uicontrols.DatePicker" Assembly="controls" %>

    <cc1:PropertyPanel id="PPanel" runat="server" Text="Date">
         <cc2:DateTimePicker id="theDate" runat="server" />
    </cc1:PropertyPanel>

    The problem is I cannot assign a value to the DateTimePicker control on Page Load / Not IsPostBack because the .Text property is read-only. What is the right way to assign a value to this control when the edit page is loaded?

    Thank you!

  • Ron G 41 posts 137 karma points
    Oct 10, 2010 @ 21:36
    Ron G
    0

    Of course, 2 seconds after I post the question, I find the answer.

    // Assign a value to the DateTimePicker
    theDate.DateTime = DateTime.Now

    // Retrieve the value from the DateTimePicker
    DateTime myDateTime;

    myDateTime = theDate.DateTime;

    // Only do date and not time
    theDate.ShowTime = false;

    Hopes this helps someone in the future.

  • Max 144 posts 166 karma points
    May 15, 2012 @ 10:16
    Max
    0

    i tried it but the desighner is nto geneared in aspx.desighner.cs file

    any ideas why ??

     

  • Jignesh 31 posts 51 karma points
    May 31, 2012 @ 15:32
    Jignesh
    0

    Hello,

    I got umbraco source code and then change in DateTimePicker class..

    there is only get property of Text so i just put Set property 

    then just update controls.dll its working fine...

    Thanks

    Jignesh Ramavat

  • Jignesh 31 posts 51 karma points
    May 31, 2012 @ 15:34
  • 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.

Please Sign in or register to post replies