I am trying to open the AppointmentAdd.aspx file by way of a button instead of the standard double click method. I saw this was in a demo "Full Page Sample" in the sample browser, but I am having trouble implementing it.
I tried using some of the script in the demo, but get an error that ScheduleInfo has no properties.
<script type="text/javascript">
<!--
// create a new appointment
var dateTime = new Date();
var minutes = dateTime.getMinutes();
dateTime.setMinutes(30);
else
dateTime.setHours(dateTime.getHours() + 1,0);
appointment.setStartDateTime(dateTime);
-->
</script>
Any suggestions?
Hello,
Sounds like the variable scheduleInfo is not getting set and is null... check the id of the WebScheduleInfo... make sure you haven't placed it in a naming container (panel, template, using master pages, etc.) as that will change the ids on you. Here's a little "trick" i've adopted when you cannot get an initialize event for the control/component on the client side:
this.ClientScript.RegisterClientScriptBlock(this.GetType(), "WebScheduleID block", "var myScheduleInfoId = '" + this.WebScheduleInfo1.ClientID + "';", true);
This will render the ClientID as it is defined and you never need to hardcode your control IDs in your client script calls.
Next, update your script as follows:
var scheduleInfo = ig_getWebScheduleInfoById(myScheduleInfoId);
and it should work as you expected.