Hello,
After much expermentation and searching through the forums, I have figured out how to show a RadScheduler appointment with a RadDock. This is triggered by the OnClientAppointmentClick. I opted to use the clientside because the server side requires the Scheduler to be editable. I only want folks in certain roles to have this ability. The final goal is that when the general public clicks on an appointment, the details are loaded. I prefer this over the common use of ToolTip. I suppose I could have created two templates, one for viewing and one for editing, loading the appropriate one depending on the the user role. I will probably use that, but is not the initial avenue I took. I went down the path of client side and have succesfully implemented this using RadDock. The one thing I did not like was that RadDock can not be modal without much tweaking. Looking at what was involved to add this behaviour, I decided to use the RadWindow. This decession has lead me here, as I have reached a stumbling block. I am currently attempting to use the RadWindow as I did the RadDock by loading content dynamically by changing the DOM using innerHTML. This was easy with RadDock, but not so with RadWindow. I have played with multiple variations and have at least prevented the nasty object is null by first showing the window and then accessing the DOM. That actually makes sense for first time load. So now my script does not cause errors, but the content does not display? I have attatched all the code so that people can see a working example of how to do this with RadDock. I have only ommitted the SQLDataSource. Please take a look at onAppointmentClick javascript function. No errors but content is not loaded. Perhaps this approach is not possible. I know that it can easily be overcome by loading a seperate control in the window. Overall that may be better, but I still want to see this work. (PS. The OnAppointmentClickDock function works. For those who want to play simply change the event in the scheduler).
After much expermentation and searching through the forums, I have figured out how to show a RadScheduler appointment with a RadDock. This is triggered by the OnClientAppointmentClick. I opted to use the clientside because the server side requires the Scheduler to be editable. I only want folks in certain roles to have this ability. The final goal is that when the general public clicks on an appointment, the details are loaded. I prefer this over the common use of ToolTip. I suppose I could have created two templates, one for viewing and one for editing, loading the appropriate one depending on the the user role. I will probably use that, but is not the initial avenue I took. I went down the path of client side and have succesfully implemented this using RadDock. The one thing I did not like was that RadDock can not be modal without much tweaking. Looking at what was involved to add this behaviour, I decided to use the RadWindow. This decession has lead me here, as I have reached a stumbling block. I am currently attempting to use the RadWindow as I did the RadDock by loading content dynamically by changing the DOM using innerHTML. This was easy with RadDock, but not so with RadWindow. I have played with multiple variations and have at least prevented the nasty object is null by first showing the window and then accessing the DOM. That actually makes sense for first time load. So now my script does not cause errors, but the content does not display? I have attatched all the code so that people can see a working example of how to do this with RadDock. I have only ommitted the SQLDataSource. Please take a look at onAppointmentClick javascript function. No errors but content is not loaded. Perhaps this approach is not possible. I know that it can easily be overcome by loading a seperate control in the window. Overall that may be better, but I still want to see this work. (PS. The OnAppointmentClickDock function works. For those who want to play simply change the event in the scheduler).
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="zzz.ascx.cs" Inherits="xxx.Modules.yyy.zzz" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<telerik:RadScriptBlock runat="server" ID="RadScriptBlock1"> |
<script type="text/javascript"> |
//<![CDATA[ |
function formatWeekName(rawDate) |
{ |
var dayofWeek = ''; |
switch (rawDate.getDay()) { |
case 0: |
dayofWeek = 'Sunday'; |
break; |
case 1: |
dayofWeek = 'Monday'; |
break; |
case 2: |
dayofWeek = 'Tuesday'; |
break; |
case 3: |
dayofWeek = 'Wednesday'; |
break; |
case 4: |
dayofWeek = 'Thursday'; |
break; |
case 5: |
dayofWeek = 'Friday'; |
break; |
case 6: |
dayofWeek = 'Saturday'; |
break; |
default: |
dayofWeek = ''; |
} |
return dayofWeek; |
} |
function formatMonthName(rawDate) |
{ |
var monthName = ''; |
switch (rawDate.getMonth()) { |
case 0: |
monthName = 'January'; |
break; |
case 1: |
monthName = 'February'; |
break; |
case 2: |
monthName = 'March'; |
break; |
case 3: |
monthName = 'April'; |
break; |
case 4: |
monthName = 'May'; |
break; |
case 5: |
monthName = 'June'; |
break; |
case 6: |
monthName = 'July'; |
break; |
case 7: |
monthName = 'August'; |
break; |
case 8: |
monthName = 'September'; |
break; |
case 9: |
monthName = 'October'; |
break; |
case 10: |
monthName = 'November'; |
break; |
case 11: |
monthName = 'December'; |
break; |
default: |
monthName = ''; |
} |
monthName = monthName + ' ' + rawDate.getDate(); |
return monthName; |
} |
function formatTime(rawDate) |
{ |
var hours = rawDate.getHours(); |
var minutes = rawDate.getMinutes(); |
var ampm; |
if (hours >= 12) { |
hours -= 10; |
ampm = " PM"; |
} |
else { |
ampm = " AM"; |
} |
if (minutes < 10) { |
minutes = "0" + minutes; |
} |
return hours + ":" + minutes + ampm; |
} |
function onAppointmentClick(sender,eventArgs) |
{ |
var appointment = eventArgs.get_appointment() |
var subject = appointment.get_subject(); |
var rawEndDate = appointment.get_end(); |
var rawStartDate = appointment.get_start(); |
var endDateTime = formatWeekName(rawEndDate) + ", " + formatMonthName(rawEndDate) + " at " + formatTime(rawEndDate); |
var startDateTime = formatWeekName(rawStartDate) + ", " + formatMonthName(rawStartDate) + " at " + formatTime(rawStartDate); |
var fbtWin = $find("<%= RadWindow1.ClientID %>"); |
fbtWin.show(); |
fbtWin.get_contentFrame().contentWindow.innerHTML = "HELLO WORLD"; |
fbtWin.hide(); |
fbtWin.show(); |
} |
function onAppointmentClickDock(sender,eventArgs) |
{ |
var appointment = eventArgs.get_appointment() |
var subject = appointment.get_subject(); |
var rawEndDate = appointment.get_end(); |
var rawStartDate = appointment.get_start(); |
var endDateTime = formatWeekName(rawEndDate) + ", " + formatMonthName(rawEndDate) + " at " + formatTime(rawEndDate); |
var startDateTime = formatWeekName(rawStartDate) + ", " + formatMonthName(rawStartDate) + " at " + formatTime(rawStartDate); |
var dock = $find("<%= RadDock1.ClientID %>"); |
var viewPort = $telerik.getViewPortSize(); |
var xPos = Math.round((viewPort.width - parseInt(dock.get_width())) / 2); |
var yPos = Math.round((viewPort.height - parseInt(dock.get_height())) / 2); |
$telerik.setLocation(dock.get_element(), { x: xPos, y: yPos }); |
var content = dock.get_contentContainer(); |
content.innerHTML = "<table width='100%' border='0'><tr><td style=' font-weight:bolder'>Start:</td><td>" + startDateTime + "</td></tr><tr><td style=' font-weight:bolder'>End:</td><td>" + endDateTime + "</td></tr><tr><td style=' font-weight:bolder'>Description:</td><td>" + subject + "</td></tr></table>"; |
dock.set_closed(false); |
} |
//]]> |
</script> |
</telerik:RadScriptBlock> |
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="RadScheduler1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="RadScheduler1" /> |
<telerik:AjaxUpdatedControl ControlID="RadDock1" LoadingPanelID="RadAjaxLoadingPanel1" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManagerProxy> |
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" |
Width="75px" Skin="WebBlue" Transparency="20"> |
<img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' |
style="border: 0px;" /> |
</telerik:RadAjaxLoadingPanel> |
<telerik:RadScheduler ID="RadScheduler1" runat="server" Height="460px" OnClientAppointmentClick="onAppointmentClick" EnableEmbeddedScripts="True" |
HoursPanelTimeFormat="htt" Skin="Outlook" ValidationGroup="ctl00_RadScheduler1" |
DataSourceID="SqlDataSource1" |
DataEndField="End" |
DataKeyField="ID" |
DataRecurrenceField="RecurrenceRule" |
DataRecurrenceParentKeyField="RecurrenceParentID" |
DataStartField="Start" |
DataSubjectField="Subject" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"> |
</telerik:RadScheduler> |
<telerik:RadDock ID="RadDock1" runat="server" DockMode="Floating" Closed="true" Skin="Outlook" Width="500px" Height="300px"> |
<ContentTemplate> |
</ContentTemplate> |
</telerik:RadDock> |
<telerik:RadWindow ID="RadWindow1" runat="server" AutoSize="True" Modal="True" Skin="Vista" > |
</telerik:RadWindow> |