Sign in | Join
Last post 10-06-2009 7:32 AM by lord_dante_iii. 11 replies.
Sort Posts: Oldest to newest Newest to oldest
I have a dynamic calendar extender & dynamic textbox being generated and an image button to show the calendar extender. I've extended the textbox to add an OnClick event, but I wanted to know how I could show a calendar extender on the server side if possible. Thanks.
What I get from your post is that you want to add a CalendarExtended to a dynamic textbox.
TextBox txtDateWorkedOn = new TextBox(); txtDateWorkedOn.Text = DateTime.Now.ToShortDateString(); txtDateWorkedOn.ID = "txtDateWorkedOn_" + idNumber.ToString(); ImageButton calendarImage = new ImageButton(); calendarImage.CssClass = "imagebutton"; calendarImage.ImageUrl = "images/icon-calendar.gif"; calendarImage.ID = "calendarImage_" + idNumber.ToString(); AjaxControlToolkit.CalendarExtender calendarExtender = new AjaxControlToolkit.CalendarExtender(); calendarExtender.TargetControlID = txtDateWorkedOn.ID; calendarExtender.PopupButtonID = calendarImage.ID;
What are you exactly trying to do? CalendarExtended will be displayed wherever the application is viewed in browser, even on the server.
I already have it setup to display the control on image click via popupbuttonid. The question is I have setup a textbox with a server side OnClick event and how would I display or render the calendar control onclick?
Do you really need an OnClick event to do that?
Whether or not I need an onclick event or not is irrelevant.... I'm asking a simple question that needs a simple answer.
Is this possible either client or server side. IE: on server side calextender.show() or textbox.attributes.add("onclick","showcalendar()")
Heres a simple answer. Yes you can.
function ShowCalendar() { $find('<%=CalendarExtender1.ClientID %>').show(); }
TextBox1.Attributes.Add("onclick", "javascript:return ShowCalendar();");
Thanks, that helps. Now I could probably pass the id to the func and it'll work more dynamically.
For some reason the TargetControlID property doesn't come up for me when I declare the calendar extender.Checking the object browser it shows the property buried underneath "Base Types\Extender Control Base" but I can't just use it like you did above:calendarExtender.TargetControlID = txtDateWorkedOn.ID;
Any ideas??
dtabraha:For some reason the TargetControlID property doesn't come up for me when I declare the calendar extender.Checking the object browser it shows the property buried underneath "Base Types\Extender Control Base" but I can't just use it like you did above:calendarExtender.TargetControlID = txtDateWorkedOn.ID; Any ideas??
Just add reference to System.Web.Extensions and everything will be fine.