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

Inline Templates

7 Answers 86 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Susan
Top achievements
Rank 1
Susan asked on 15 Jun 2009, 12:53 AM
I have looked for an answer to my problem, but cannot figure it out. Here is a copy of my code. When I execute it, it errors in the _FormCreated as the subjectBox is Nothing.

<telerik:RadScheduler runat="server" ID="calEvents" Width="925" ShowViewTabs="false" StartEditingInAdvancedForm="false" Skin="Office2007"
                                OnAppointmentCommand="RadScheduler1_AppointmentCommand" OnFormCreated="calEvents_FormCreated" OnFormCreating="calEvents_FormCreating">
                                    <InlineInsertTemplate>
                                    <div id="InlineInsertTemplate"> 
                                        <table cellpadding="0" class="0" runat="server">
                                            <tr>
                                                <td colspan="6">
                                                    <asp:TextBox ID="TitleTextBox" runat="server" Width="90%" TextMode="MultiLine" Height="20px"/></td></tr>
                                                   
                                            <tr>
                                                <td width="3%">
                                                    <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert">
                                                        <asp:Image runat="server" ID="insertImage" ImageUrl="~/Images/tick.png" AlternateText="insert" /></asp:LinkButton></td>
                                                <td width="7%">
                                                    <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel">
                                                        <asp:Image runat="server" ID="Image2" ImageUrl="~/Images/cancel.png" AlternateText="cancel" />
                                                    </asp:LinkButton></td>
                                                <td width="18%">
                                                    <asp:Label ID="Label7" CssClass="Normal11" runat="server" Text="Background Color" /></td>
                                                <td width="37%" valign="middle">
                                                    <asp:RadioButtonList runat="server" ID="AppointmentTypeRadioButtonList" RepeatDirection=Horizontal>
                                                        <asp:ListItem Text="Yellow" Value="Yellow"></asp:ListItem>
                                                        <asp:ListItem Text="Light Blue" Value="Light Blue"></asp:ListItem>
                                                        <asp:ListItem Text="Tan" Value="Tan"></asp:ListItem>
                                                    </asp:RadioButtonList></td>
                                                <td width="35%">
                                                    <asp:LinkButton ID="InsertMoreButton" runat="server" CommandName="AdvancedInsertOptions" CssClass="rsAdvancedEditLink">Advanced</asp:LinkButton></td>
                                            </tr>
                                        </table>
                                    </div>
                                    </InlineInsertTemplate>
                                   
                                   
                                    <AdvancedInsertTemplate>
                                    <div id="AdvancedInsertTemplate"> 

                                        <table id="Table2" cellpadding="0" class="0" runat="server">
                                            <tr>
                                                <td>
                                                    <asp:Label ID="Label8" AssociatedControlID="TitleTextBox" runat="server" CssClass="inline-label">Description</asp:Label></td></tr>

                                            <tr>
                                                <td>
                                                    <asp:TextBox ID="TitleTextBox" Rows="5" Columns="20" runat="server" Width="97%" TextMode="MultiLine"></asp:TextBox></td></tr>
                                                       
                                            <tr>
                                                <td width="3%">
                                                    <asp:Label ID="Label5" AssociatedControlID="StartInput" runat="server" CssClass="inline-label">Start time:</asp:Label></td>
                                                <td width="7%">
                                                    <telerik:RadDateInput ID="StartInput" runat="server"/></td></tr>
                                                   
                                            <tr>
                                                <td width="18%">
                                                    <asp:Label ID="Label6" AssociatedControlID="EndInput" runat="server" CssClass="inline-label">End time:</asp:Label></td>
                                                <td>
                                                    <telerik:RadDateInput ID="EndInput" runat="server"/></td></tr>
                                                   
                                            <tr>
                                                <td width="37%" valign="middle">
                                                    <asp:RadioButtonList runat="server" ID="AppointmentTypeRadioButtonListAdvanced" RepeatDirection=Horizontal>
                                                        <asp:ListItem Text="Yellow" Value="Yellow"></asp:ListItem>
                                                        <asp:ListItem Text="Light Blue" Value="Light Blue"></asp:ListItem>
                                                        <asp:ListItem Text="Tan" Value="Tan"></asp:ListItem>
                                                    </asp:RadioButtonList></td></tr>
                                                   
                                            <tr>
                                                <td width="35%">
                                                    <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert"/></td>
                                                <td width="3%">
                                                    <asp:LinkButton ID="UpdateButtonAdvanced" runat="server" CommandName="Insert">
                                                        <asp:Image runat="server" ID="updateImage" ImageUrl="~/Images/tick.png" AlternateText="update" /></asp:LinkButton></td>
                                                <td width="7%">
                                                    <asp:LinkButton ID="CancelButtonAdvanced" runat="server" CausesValidation="False" CommandName="Cancel">
                                                        <asp:Image runat="server" ID="Image2" ImageUrl="~/Images/cancel.png" AlternateText="cancel" />
                                                    </asp:LinkButton></td>
                                                   
                                                   
                                            </tr>
                                        </table>
                                    </div>
                                    </AdvancedInsertTemplate>
                            </telerik:RadScheduler>


  Protected Sub calEvents_FormCreated(ByVal sender As Object, ByVal e As SchedulerFormCreatedEventArgs)

    Dim scheduler As RadScheduler = DirectCast(sender, RadScheduler)

    If e.Container.Mode = SchedulerFormMode.AdvancedInsert OrElse e.Container.Mode = SchedulerFormMode.AdvancedEdit Then

      Dim subjectBox As TextBox = DirectCast(e.Container.FindControl("TitleTextBox"), TextBox)
      subjectBox.Text = e.Appointment.Subject

    End If

  End Sub

Thanks so much,
Susan


7 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 15 Jun 2009, 09:02 AM
Hello Susan,

We tested your code and it worked fine at our end. Anyway, you can try to binding the Text property inline:

 <asp:TextBox ID="TitleTextBox" Text='<%# Bind("Subject") %>' Rows="5" Columns="20" runat="server" Width="97%" TextMode="MultiLine"></asp:TextBox> 
                       


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
Susan
Top achievements
Rank 1
answered on 15 Jun 2009, 08:12 PM
Peter,
I get the same error. Let me show you my databinding, as that is obviously different that what you are testing my code with. Maybe I'm doing something wrong there. It is in my code-behind:

    Dim CalendarEventDAL as New CalendarEventDAL

    objReader = CalendarEventDAL.GetEventsByOrganization(Viewstate("OrganizationKey"))

    calEvents.DataSource = objReader
    calEvents.DataStartField = "EventStartTime"
    calEvents.DataEndField = "EventEndTime"
    calEvents.DataKeyField = "CalendarEventOrganizationKey"
    calEvents.DataSubjectField = "EventName"
    calEvents.DataBind

    If Not objReader.IsClosed Then objReader.Close

Thanks,
Susan
0
Peter
Telerik team
answered on 16 Jun 2009, 01:47 PM

I should have mentioned that when binding the Text property inline as I suggested in my previous reply, you no longer need to access the title textbox in FormCreated. Yet, the Text property will populate with the appointment subject.


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
Susan
Top achievements
Rank 1
answered on 16 Jun 2009, 11:59 PM
Thanks Peter. That took care of the error. Now, however, when I 'Save', I would assume it would call my 'calEvents_AppointmentInsert' method. I put a breakpoint there, but it never gets called.

<telerik:RadScheduler runat="server" ID="calEvents" Width="925" ShowViewTabs="false" StartEditingInAdvancedForm="false" Skin="Office2007" OnAppointmentInsert="calEvents_AppointmentInsert" OnFormCreating="calEvents_FormCreating">

  Protected Sub calEvents_AppointmentInsert(ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerCancelEventArgs)

    Dim CalendarEventDAL as New CalendarEventDAL
    Dim CalendarEventBE as New CalendarEventBE

    CalendarEventBE.OrganizationKey = Viewstate("OrganizationKey")
    CalendarEventBE.EventName = e.Appointment.Subject
    CalendarEventBE.EventStartTime = e.Appointment.Start
    CalendarEventBE.EventEndTime = e.Appointment.End
    CalendarEventBE.EventBGColor = "#FFFF66"

    CalendarEventDAL.SaveOrganizationEvent(CalendarEventBE)

    calEvents.Rebind

  End Sub

Thanks for the help. I'll get there eventually....

Susan
0
Peter
Telerik team
answered on 17 Jun 2009, 12:21 PM

Yes, AppointmentInsert' should occur if you are creating a new appotiment. If you are just editing an existing appointment, then you need to handle AppointmentUpdate. Can you please make sure that this is not the case?


All the best,
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
Susan
Top achievements
Rank 1
answered on 17 Jun 2009, 01:20 PM
This is brand new logic - I have not used it. There are no existing appointments. I'm double-clicking a time slot on the calendar and the first inline template appears (the smaller on). I think click 'Advanced' and the advanced template appears. I enter the subject and press 'Save'. The AppointmentCreated does not get fired.

Thanks,
Susan
0
Peter
Telerik team
answered on 17 Jun 2009, 01:29 PM

That's unusual. Can you open a support ticket and send us a simple working demo which we can test locally?


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
Susan
Top achievements
Rank 1
Answers by
Peter
Telerik team
Susan
Top achievements
Rank 1
Share this question
or