Wednesday, March 28, 2012

Why this doesnt work :(

Hi

I'm trying to create an calendarextender programmatically but it doesn't work :(

here is the code:

scriptManager =newScriptManager();

dateTimeMaskedTextBox =newTextBox();

dateTimeMaskedTextBox.ID ="DateTimer";

dateTimePicker =newImage();dateTimePicker.ID ="dateTimePicker";

dateTimePicker.ImageUrl =@dotnet.itags.org."~/icons/Calendar_scheduleHS.png";

calendar =newCalendarExtender();

calendar.TargetControlID ="DateTimer";

calendar.FirstDayOfWeek =FirstDayOfWeek.Monday;calendar.Format ="dd/MM/yyyy";

calendar.PopupButtonID = dateTimePicker.ID;

what's wrong with this???????

thanks.

you never actually add the control to the form. creating them in the code doesnt mean they are on the form. To add a control to a form programatically you do something like this.

Form1.Controls.Add(calendar);

so make sure you add your script manager, datetimepicker, datetimemasked box and calendar to the form you want it in


hmmmmmmmmSurprise

thanks a lot

I thought that calendar (CalendarExtender) it's not neccessary to be added on the form.

thanks in advance.

No comments:

Post a Comment