Link to home
Start Free TrialLog in
Avatar of w3digital
w3digital

asked on

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

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.
ASKER CERTIFIED SOLUTION
Avatar of ovalsquare
ovalsquare

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of w3digital
w3digital

ASKER

Thanks Ted. Perfect!
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.

Chris.
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?

Ted
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,

Chris
Glad it worked out!

Ted