This is a migrated thread and some comments may be shown as answers.

change onAppointment Click behavior

4 Answers 139 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Sohail
Top achievements
Rank 1
Sohail asked on 22 Jan 2012, 09:57 PM
Hi,
m new user of telerik i want to change the behaviour of Scheduler Appointment Click. on appointment click i want to open a RadWindow having information of that appointment and the resource detail by joining other tables from database..
Plz reply me how to achive that behaviour by using C#

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Jan 2012, 06:17 AM
Hello Sohail,

You can invoke ajax request in OnClientAppointmentClick and then create a RadWindow. Here is the sample code.
aspx:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
  <AjaxSettings>
    <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
        <UpdatedControls>
           <telerik:AjaxUpdatedControl ControlID="RadScheduler1" />
           <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
         </UpdatedControls>
    </telerik:AjaxSetting>
 </AjaxSettings>
</
telerik:RadAjaxManager>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
</telerik:RadWindowManager>
JS:
<script type="text/javascript">
function
OnClientAppointmentClick(sender, args)
{
 var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
 ajaxManager.ajaxRequest(args.get_appointment().get_subject());
}
</script>
C#:
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
      string AppointmentSubject = e.Argument;
      RadWindow window1 = new RadWindow();
      RadWindowManager1.Windows.Add(window1);            
       window1.VisibleOnPageLoad = true;
}

-Shinu.
0
Sohail
Top achievements
Rank 1
answered on 23 Jan 2012, 07:24 PM
Thanks Shinu For reply..
i did wht u have told but i got this exception

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
   System.Web.UI.ControlCollection.AddAt(Int32 index, Control child) +8689774
   Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +226

[HttpException (0x80004005): Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error.]
   Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +291
   Telerik.Web.UI.RadAjaxControl.PerformRender() +508
   Telerik.Web.UI.RadAjaxControl.OnPageRender(HtmlTextWriter writer, Control page) +1841
   Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +158
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060
Kindly let me know how to resolve this.
Thanks
0
Sohail
Top achievements
Rank 1
answered on 23 Jan 2012, 07:42 PM
hi
i resolve this problem by using RadCode Block and wrap my script tag in code block. but now when i run my scheduler no event respond e.g if i click on time line no new appointment window appear and not a single thing of RadScheduler is working
0
Shinu
Top achievements
Rank 2
answered on 24 Jan 2012, 05:54 AM
Hello Sohail,

Placing the script in RadCodeBlock worked as expected in my end. If you are using some global javascript, make sure that you refer the javascript accordingly.

-Shinu.
Tags
Scheduler
Asked by
Sohail
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Sohail
Top achievements
Rank 1
Share this question
or