Inline Templates

8 posts, 0 answers
  1. Susan
    Susan avatar
    137 posts
    Member since:
    Jul 2007

    Posted 14 Jun 2009 Link to this post

    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


  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 15 Jun 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Susan
    Susan avatar
    137 posts
    Member since:
    Jul 2007

    Posted 15 Jun 2009 Link to this post

    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
  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 16 Jun 2009 Link to this post


    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.
  6. Susan
    Susan avatar
    137 posts
    Member since:
    Jul 2007

    Posted 16 Jun 2009 Link to this post

    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
  7. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 17 Jun 2009 Link to this post


    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.
  8. Susan
    Susan avatar
    137 posts
    Member since:
    Jul 2007

    Posted 17 Jun 2009 Link to this post

    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
  9. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 17 Jun 2009 Link to this post


    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017