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

[Solved] Custom Templates

3 Answers 253 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jose
Top achievements
Rank 1
Jose asked on 23 Apr 2009, 05:42 PM
Hello,

I am having an issue with the custom templates with the scheduler, What i am trying to do is, have a custom template for inline insert and for the advanced. What i did was create a template for the inline insert with 3 buttons (insert, cancel, advanced), the insert and cancel buttons work fine, but after i click the advanced it throws a "Object reference not set to an instance of an object." and it has this stack trace "
 Telerik.Web.UI.RadScheduler.SwitchToAdvancedMode() +202
 Telerik.Web.UI.RadScheduler.OnBubbleEvent(Object source, EventArgs args) +582
 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 "
But if I use the default template for the inline insert then click "options" it will show my custom advanced template.
Seems like i am missing something, so i would appreciate any help.
Here is my code for the schedule control:

 <pro:RadScheduler runat="server" ID="RadScheduler1" Width="750px" SelectedDate="2007-03-30"
            DayStartTime="08:00:00" DayEndTime="18:00:00" ShowViewTabs="false" StartEditingInAdvancedForm="false"
            DataSourceID="MessagesDataSource" DataKeyField="MessageId" DataSubjectField="MessageText"
            DataStartField="Start" DataEndField="End" DataRecurrenceField="RecurrenceRule"
            DataRecurrenceParentKeyField="RecurrenceParentID" OnAppointmentCommand="RadScheduler1_AppointmentCommand"
            OnFormCreated="RadScheduler1_FormCreated" OnFormCreating="RadScheduler1_FormCreating">
            
            
            <AppointmentTemplate>
                <div>
                </div>
            </AppointmentTemplate>
            <InlineEditTemplate>
            <div>
            <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert" Text="insert">
                            
                        </asp:LinkButton>
                        <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="cancel">
                            
                        </asp:LinkButton>
                        <asp:LinkButton ID="InsertMoreButton" runat="server" CommandName="More" CssClass="rsAdvancedEditLink">Advanced</asp:LinkButton>
            </div>
            </InlineEditTemplate>
            <InlineInsertTemplate>
            <div>
                        <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert" Text="insert">
                            
                        </asp:LinkButton>
                        <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="cancel">
                            
                        </asp:LinkButton>
                        <asp:LinkButton ID="InsertMoreButton" runat="server" CommandName="More" CssClass="rsAdvancedEditLink">Advanced</asp:LinkButton>
            </div>
            </InlineInsertTemplate>
            <AdvancedEditTemplate>
               <div>
               Advanced EDIT TEMP
               </div>
            </AdvancedEditTemplate>
            <AdvancedInsertTemplate>
              <div>
               Advanced TEMP
               </div>
            </AdvancedInsertTemplate>
        </pro:RadScheduler>

Regards


3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 27 Apr 2009, 04:14 PM
Hi Jose,

RadScheduler does not recognize the "More" Command Name. Here is a workaround which you can use instead:

<InlineEditTemplate> 
<asp:TextBox ID="TextBox1" Text='<%#Bind("Subject") %>' runat="server"></asp:TextBox> 
    <div> 
        <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert" Text="insert">  
                      
        </asp:LinkButton> 
        <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" 
            Text="cancel">  
                      
        </asp:LinkButton> 
        <asp:LinkButton ID="InsertMoreButton" CommandName="AdvancedEditOptions" runat="server" 
            CssClass="rsAdvancedEditLink">Advanced</asp:LinkButton> 
    </div> 
</InlineEditTemplate> 
<InlineInsertTemplate> 
    <div> 
        <asp:TextBox ID="TextBox1" Text='<%#Bind("Subject") %>' runat="server"></asp:TextBox> 
        <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert" Text="insert">  
                      
        </asp:LinkButton> 
        <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" 
            Text="cancel">  
                      
        </asp:LinkButton> 
        <asp:LinkButton ID="InsertMoreButton" CommandName="AdvancedInsertOptions" runat="server" 
            CssClass="rsAdvancedEditLink">Advanced</asp:LinkButton> 
    </div> 
</InlineInsertTemplate> 

 private string InsertedAppointmentSubject;  
    protected void RadScheduler1_AppointmentCommand(object sender, AppointmentCommandEventArgs e)  
    {  
        if (e.CommandName == "AdvancedInsertOptions")   
        {  
            IBindableTemplate template = (IBindableTemplate) e.Container.Template;  
            IOrderedDictionary values = template.ExtractValues(e.Container);  
            InsertedAppointmentSubject = (string)values["Subject"];  
            RadScheduler1.ShowAdvancedInsertForm(e.Container.Appointment.Start);  
              
        }  
        else if (e.CommandName == "AdvancedEditOptions")  
        {  
            RadScheduler1.ShowAdvancedEditForm(e.Container.Appointment);  
        }  
    }  
    protected void RadScheduler1_FormCreating(object sender, SchedulerFormCreatingEventArgs e)  
    {  
        if (e.Mode == SchedulerFormMode.AdvancedInsert)  
        {  
            e.Appointment.Subject = InsertedAppointmentSubject;  
        }  
    } 



Kind 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, 04:16 PM
Peter,

I am trying to do something similar, except instead of adding an "Advanced" button to the inline edit template, I simply want to add an edit button the AppointmentTemplate, so users can click it to edit the item instead of double clicking.  I have the button working so it takes me to the edit form, but I am not sure how to get it to fire the "edit series/single occurrence" dialog box if the item is part of a series.  Are there any examples on how to do that?  

Basically I want to have a button on the appointment template perform exactly the same as double clicking the appointment, including asking the user if they want to edit the series or a single occurence.

Thanks,
Laura
0
Dimitar Milushev
Telerik team
answered on 09 Jun 2009, 04:05 PM
Hello laura,

We recently added two very useful methods to the RadScheduler's client-side object:

editAppointmentWithConfirmation(appointment)
deleteAppointmentWithConfirmation(appointment)

If you want to give them a try before the official release, starting from tomorrow they will be available in our latest internal builds at http://www.telerik.com/account/latest-internal-builds.aspx

Of course, they will be available in the next official release too.

Greetings,
Dimitar Milushev
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
Jose
Top achievements
Rank 1
Answers by
Peter
Telerik team
laura
Top achievements
Rank 1
Dimitar Milushev
Telerik team
Share this question
or