datepicker in usercontrol Options
PeterD
Posted: Thursday, February 14, 2008 10:34:36 PM

Rank: Fanatic

Joined: 7/20/2006
Posts: 409
Location: NL
I'm trying to get a datepicker in a usercontrol to work, so far, no luck......
Anyone did this before and got it working?
If so, care to share the code to get it to work?

Cheers,
PeterD

FOR EACH brokenitem EXCLUSIVE-LOCK:
RUN FixBrokenItem.
RUN ImproveBrokenItem.
END.
PeterD
Posted: Thursday, February 14, 2008 11:48:33 PM

Rank: Fanatic

Joined: 7/20/2006
Posts: 409
Location: NL
Nevermind, I found the solution :D

FOR EACH brokenitem EXCLUSIVE-LOCK:
RUN FixBrokenItem.
RUN ImproveBrokenItem.
END.
dawoe
Posted: Friday, February 15, 2008 12:15:52 PM

Rank: Aficionado

Joined: 1/19/2008
Posts: 134
Location: Belgium
Do you want to share this solution ?

Converting a DotNetNuke site to Umbraco : Follow it here
PeterD
Posted: Friday, February 15, 2008 1:37:40 PM

Rank: Fanatic

Joined: 7/20/2006
Posts: 409
Location: NL
Dave Woestenborghs wrote:

Do you want to share this solution ?


I actually was expecting this post :cool:

I dont have the code at hand right now, but I'll post a short sample later today when I get home. If tomorrow still nothing is here, pls remind me :blush:


From the top of my head:
I added a placeholder to the control.
In the pageload I create a datepicker and add it to the placeholder.
Then on the button-click I find the control on the placeholder and read its value.

But as said, I'll post a codesample if I get home later today.

PeterD

FOR EACH brokenitem EXCLUSIVE-LOCK:
RUN FixBrokenItem.
RUN ImproveBrokenItem.
END.
PeterD
Posted: Friday, February 15, 2008 5:58:37 PM

Rank: Fanatic

Joined: 7/20/2006
Posts: 409
Location: NL
As promised, here goes:

Create a new usercontrol and place a PlaceHolder, a Label and a Button on it.

Then, in the codebehind you can do this:

Code:

    public partial class YourUserControl : System.Web.UI.UserControl
    {
        protected umbraco.controls.datePicker dp = new umbraco.controls.datePicker();

        protected void Page_Load(object sender, EventArgs e)
        {

            dp.ID = "displaydate";
            dp.ShowTime = true;
            PlaceHolder1.Controls.Add(dp);

        }

        protected void Button1_Click(object sender, EventArgs e)
        {

            TextBox tb = (TextBox)PlaceHolder1.FindControl("displaydate");
            Label1.Text = tb.Text;

        }
    }


Hope this clarifies things a bit.
Or if anyone has a simpler solution, please post :cool:

Cheers,
PeterD



FOR EACH brokenitem EXCLUSIVE-LOCK:
RUN FixBrokenItem.
RUN ImproveBrokenItem.
END.
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.