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

Recurrence in new page

3 Answers 196 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
laura
Top achievements
Rank 1
laura asked on 26 May 2009, 04:54 PM
I am using the RadScheduler and here is my scenario:
  • I would like to disable the onclick event of the scheduler control and add an external button that says "add event"
  • When users click this button, I would like it to open a custom insert form with custom attributes that also uses recurrence
  • I need this custom insert form to be a web page not a user control

I have been working with this control for a very short time and I have the custom attributes and recurrence working just fine in a user control.  When I try using the schedulerDefaultForm as part of a webpage, however, it gives me an error because the schedulerFormContainer is null, therefore the appointment and owner fields are null and I get null reference exceptions.  I have searched around the forums and documentation a bit but I can't find an example of a custom insert form that is a web page and not a user control.  Any help would be appreciated.

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 27 May 2009, 08:52 AM
Hi laura,

1. To disable the onclick event of RadScheduler, you should cancel the OnClientAppointmentInserting event:
 function OnClientAppointmentInserting(sender, eventArgs)   
        {  
            eventArgs.set_cancel(true);  
        } 

2. Use the ShowAdvancedInsertForm method:
 protected void Button1_Click(object sender, EventArgs e)  
    {  
        RadScheduler1.ShowAdvancedInsertForm(DateTime.Now);  
    } 

To customize the advanced form, you can either use the advanced templates demo or the external edit in RadDock demo.

Here are the kb articles with demos attached of the above examples:

http://www.telerik.com/support/kb/aspnet-ajax/scheduler/sample-project-of-the-customizing-the-advanced-template-example.aspx

http://www.telerik.com/support/kb/aspnet-ajax/scheduler/show-the-advanced-edit-or-insert-form-in-raddock.aspx


Regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
laura
Top achievements
Rank 1
answered on 27 May 2009, 12:42 PM
Thanks, Peter, for your reply.  I should have been more clear when I said I need the custom insert form to be a web page and not a user control.  Basically, I want to be able to have the scheduler control on a page called Scheduler.aspx and when I click the "add event" button, I want to be taken to a page called AddEvent.aspx that has my custom insert form with recurrence on it.  The end result of all of this is that i could have multiple insert forms that would insert different types of events depending on which "add event" button I click on.  So I need to be able to redirect to different pages with different insert forms on them.

I kept working on this after my first post and the problem I kept running into when trying to use the SchedulerDefaultForm on a separate page is that, as far as I can tell, the javascript file that contains the recurrence functionality relies on my page having a scheduler control on it.  Maybe I'm doing something wrong but the javascript errors on these lines because it can't find the scheduler control:

 
var $ = $telerik.$;  
var $T = Telerik.Web.UI;  
var $DateTime = $T.Scheduler.DateTime; 

I saw this example in the online documentation: http://www.telerik.com/help/aspnet-ajax/schedule_howtoreplacingtheeditform.html.  It describes an AdvancedForm.aspx page that seems to be what I am trying to do, but instead of using the RadWindowManager, I would like to just redirect to the page.  I am not sure if this AdvancedForm.aspx has the recurrence functionality incorporated though.  It mentions a "Quick Start" demo that I haven't been able to find yet.
0
Accepted
Peter
Telerik team
answered on 30 May 2009, 11:13 AM
Hello laura,

I would use the PostBackUrl property of the button and send data across pages via a hidden field. Here is a simple demo:

Default.aspx (start page):
<asp:ScriptManager ID="ScriptManager1" runat="server">  
    </asp:ScriptManager> 
    <asp:HiddenField ID="HiddenField1" runat="server" /> 
     <asp:Button ID="Button1" runat="server"   
        PostBackUrl="~/ExternalEdit/Default2.aspx"   
        Text="Schedule appointment for May 30, 10 am" onclick="Button1_Click"  /> 
     <asp:Button ID="Button2" runat="server"   
        PostBackUrl="~/ExternalEdit/Default2.aspx"   
        Text="Schedule appointment for May 30, 4 pm" onclick="Button2_Click"   /> 
      
    <telerik:RadScheduler ID="RadScheduler1" runat="server"   
        DataEndField="End" DataKeyField="ID" DataRecurrenceField="RecurrenceRule"   
        DataRecurrenceParentKeyField="RecurrenceParentID" DataSourceID="SqlDataSource1"   
        DataStartField="Start" DataSubjectField="Subject" HoursPanelTimeFormat="htt"   
        ValidationGroup="RadScheduler1">  
    </telerik:RadScheduler> 

Default.aspx code-behind:
protected void Button1_Click(object sender, EventArgs e)  
    {  
        HiddenField1.Value = "2009/05/30 10:00:00";  
    }  
    protected void Button2_Click(object sender, EventArgs e)  
    {  
        HiddenField1.Value = "2009/05/30 16:00:00";  
    } 

Default2.aspx (the page to show RadScheduler's advanced insert form)
<telerik:RadScheduler ID="RadScheduler1"   
        runat="server"          
        DataEndField="End" DataKeyField="ID" 
        DataRecurrenceField="RecurrenceRule"   
        DataRecurrenceParentKeyField="RecurrenceParentID" 
        DataSourceID="SqlDataSource1"   
        DataStartField="Start" DataSubjectField="Subject"   
        HoursPanelTimeFormat="htt"   
        ValidationGroup="RadScheduler1" ondatabound="RadScheduler1_DataBound"   
        >  
    </telerik:RadScheduler> 
This is just RadScheduler bound to the same data table as the one from the starting page.

Default2.aspx code-behind:
 protected void Page_Load(object sender, EventArgs e)  
    {  
        if (PreviousPage != null)  
        {  
            HiddenField AppointmentTimeArg = PreviousPage.FindControl("HiddenField1"as HiddenField;  
            DateTime AppointmentTime = DateTime.Parse(AppointmentTimeArg.Value);  
            RadScheduler1.ShowAdvancedInsertForm(AppointmentTime);          
        }          
    }  
 
    protected void RadScheduler1_DataBound(object sender, EventArgs e)  
    {  
        if(PreviousPage == null)  
            Response.Redirect("Default.aspx");  
    } 



Best wishes,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Scheduler
Asked by
laura
Top achievements
Rank 1
Answers by
Peter
Telerik team
laura
Top achievements
Rank 1
Share this question
or