C# Script request: using a calendar control in a datalist within EditItemTemplate

Posted on 2005-05-05
Last Modified: 2008-01-09
I have tried and failed and searched for info on this with no real satisfactory answer.

I need to use a calendar control within the EditItemTemplate of a DataList. I'm keen to avoid a 'pop-up' calendar so prefer it in the page.

The idea is that there is a form with the following elements

1. A text input field for a date
2. Next to this field is a small calendar icon
3. Beneath this is a calendar control with visibility set to false.

The user clicks the calendar icon and the calendar control appears. Then the user clicks a day and the text box is updated with the selected date and the calendar's visibility is set back to false.

This is easy to do normally, but within a datalist I have problems with the control NOT being recognised.
Question by:w3digital
    LVL 5

    Accepted Solution

    I always end up using eWorld's Calendar Popup (which is actually not a popup, so don't be mislead by the name). It does exactly what you require and it's wrapped in a nice clean package.

    Here's the files and description: and here's a demo:

    Let me know if you need help dealing with it in a datalist.


    Author Comment

    Thanks Ted. Perfect!

    Author Comment

    OK, Ted.

    Yes I need help, I've fallen at the first hurdle :(

    I've installed but get the error of:  System.Web.UI.HtmlControls.HtmlTableCellCollection must have items of type 'System.Web.UI.HtmlControls.HtmlTableCell'. 'ew:CalendarPopup' is of type 'eWorld.UI.CalendarPopup'.

    I've installed to GAC and added a reference to the code behind (if that's what I'm meant to do) and searched for the answer to this in the forums with no help.

    Perhaps you could post a small code snippet of how to implement it?

    I'd be most grateful.

    I notice you answered another post of mine relating to a similar question which this also solves so I've award points there for you too.

    Thanks again.

    LVL 5

    Expert Comment

    You're dealing with adding a collection of table cells programatically, so you need to be placing each control within the appropriate control. Can you post your code so I can take a look at what's missing in your particular case?


    Author Comment

    Thanks for your help Ted.

    I rebuilt the page and it was fine. Odd.

    I think the calendar control could have used a touch more documentation and a few example scripts but I muddled my way through from a bit of trial and error and the some of the forum posts.

    Everything working fine and dandy now.

    All the best,

    LVL 5

    Expert Comment

    Glad it worked out!


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now