Issue with AdvancedEditTemplate

3 posts, 1 answers
  1. Artur
    Artur avatar
    3 posts
    Member since:
    May 2011

    Posted 06 May 2011 Link to this post

    Hi,

    I'm working with a scheduler that have a DataSource coming from a database. My problem is when i do a right click and go to the edit form, or the screen freeze or its raised a object null exeption whith the source in the telerik's assembly. In the aspx i'm using the code in this tutorial :http://www.telerik.com/help/aspnet-ajax/scheduler-custom-modal-advanced-template.html.
    Here i'm setting the radScheduler's DataSource
    protected void imbPesquisarEvento_Click(object sender, ImageClickEventArgs e)
       {
           try
           {
               BpAgendaFamilia bpAgendaFamilia = new BpAgendaFamilia();
               DateTime periodo = (DateTime)RdDataPeriodo.SelectedDate;
               EcoArrayList listaHorarios = bpAgendaFamilia.RetornarAgenda(IdProfissional, periodo.Month, periodo.Year);
               if (listaHorarios.Count != 0)
               {
                   ListaHorarios = listaHorarios.Cast<BeAgendaFamilia>().ToList();
                   List<AppointmentInfo> listaAppointment = new List<AppointmentInfo>();
                   foreach (BeAgendaFamilia horario in listaHorarios)
                   {
                       BeFamilia familia = (BeFamilia)new Processador().Load(typeof(BeFamilia), horario.IdFamilia);
                       Appointment appointment = new Appointment();            
                       appointment.ID = horario.agd_familia_sequencial.ToString();
                       appointment.Start = horario.agd_familia_tempo_inicio;
                       if (familia != null)
                           appointment.Subject = familia.Exibicao;
                       else
                           appointment.Subject = "Horário Livre";
                       appointment.End = horario.agd_familia_tempo_fim;
                       Appointments.Add(appointment);
                   }   
                   RadScheduler1.DataSource = Appointments;
               }
               else
                   RadAjaxManager1.Alert("O Profissional não possue agenda criada no periodo informado. Crie a agenda do profissional em Ambulatorio/Agenda/Gerar Agenda.");
           }
           catch (Exception ex)
           {
               RadAjaxManager1.Alert(ex.Message);
           }
       }

    My aspx whith the AdvanceEditTemplate
    <telerik:RadScheduler runat="server" ID="RadScheduler1" Skin="Windows7" Height="551px"
                           ShowFooter="False" SelectedDate="2011-04-01" TimeZoneOffset="03:00:00" DayEndTime="21:00:00"
                           FirstDayOfWeek="Monday" LastDayOfWeek="Friday" EnableDescriptionField="True"
                           StartEditingInAdvancedForm="true" StartInsertingInAdvancedForm="true" AppointmentStyleMode="Default"
                           OnNavigationComplete="RadScheduler1_NavigationComplete" OnAppointmentCreated="RadScheduler1_AppointmentCreated"
                           OnAppointmentDataBound="RadScheduler1_AppointmentDataBound" OnAppointmentDelete="RadScheduler1_AppointmentDelete"
                           OnAppointmentUpdate="RadScheduler1_AppointmentUpdate" OnAppointmentInsert="RadScheduler1_AppointmentInsert"
                           Culture="Portuguese (Brazil)" OnFormCreated="RadScheduler1_FormCreated1" SelectedView="MonthView"
                           OnAppointmentCommand="RadScheduler1_AppointmentCommand" AllowEdit="true">
                           <AdvancedForm Modal="true" />
                           <TimelineView UserSelectable="false" />
                           <AppointmentTemplate>
                               <div class="rsAptSubject">
                                   <%# Eval("Subject") %>
                               </div>
                               <%# Eval("Description") %>
                           </AppointmentTemplate>
    <AdvancedEditTemplate>
                                <div class="rsAdvancedEdit rsAdvancedModal" style="position: relative">
                                    <div class="rsModalBgTopLeft">
                                    </div>
                                    <div class="rsModalBgTopRight">
                                    </div>
                                    <div class="rsModalBgBottomLeft">
                                    </div>
                                    <div class="rsModalBgBottomRight">
                                    </div>
                                    <asp:LinkButton runat="server" ID="LinkButton1" CssClass="rsAdvEditClose" CommandName="Cancel"
                                        CausesValidation="false" ToolTip='<%# Container.Appointment.Owner.Localization.AdvancedClose %>'>
    <%# Container.Appointment.Owner.Localization.AdvancedClose%>
                                    </asp:LinkButton>
                                </div>
                                <div class="rsAdvContentWrapper">
                                    <asp:Label ID="lblFamilia" runat="server" Text="Familia" Label='<%# Container.Appointment.Owner.Localization.AdvancedSubject%>'></asp:Label>
                                    <asp:DropDownList ID="ddlFamilia" runat="server" Label='<%# Container.Appointment.Owner.Localization.AdvancedSubject%>'>
                                    </asp:DropDownList>
                                    <p>
                                        <%--  Custom content here...--%>
                                    </p>
                                    <asp:Panel runat="server" ID="Panel1" CssClass="rsAdvancedSubmitArea">
                                        <div class="rsAdvButtonWrapper">
                                            <asp:LinkButton CommandName="Update" runat="server" ID="LinkButton2" CssClass="rsAdvEditSave">
    <span><%# Container.Appointment.Owner.Localization.Save%></span>
                                            </asp:LinkButton>
                                            <asp:LinkButton runat="server" ID="LinkButton3" CssClass="rsAdvEditCancel" CommandName="Cancel"
                                                CausesValidation="false">
    <span><%# Container.Appointment.Owner.Localization.Cancel%></span>
                                            </asp:LinkButton>
                                        </div>
                                    </asp:Panel>
                                </div>
                                </div>
                            </AdvancedEditTemplate>

    and here is my event handles
    protected void RadScheduler1_FormCreated1(object sender, SchedulerFormCreatedEventArgs e)
      {
          try
          {
              if (e.Container.Mode == SchedulerFormMode.AdvancedInsert)
              {
                  CarregarComboFamilia(e.Container);
              }
              if (e.Container.Mode == SchedulerFormMode.AdvancedEdit)
              {
                  CarregarComboFamilia(e.Container);
                  DropDownList ddlFamilia = (DropDownList)e.Container.FindControl("ddlFamilia");
                  if (ddlFamilia.Items.FindByText(e.Appointment.Subject) != null)
                      ddlFamilia.Items.FindByText(e.Appointment.Subject).Selected = true;
                  else
                      ddlFamilia.Items[0].Selected = true;
              }
          }
          catch (Exception ex)
          {
              RadAjaxManager1.Alert(ex.Message);
          }
      }
      protected void RadScheduler1_AppointmentCommand(object sender, AppointmentCommandEventArgs e)
      {
          if (e.CommandName == "Insert")
          {
              DropDownList ddlFamilia = (DropDownList)e.Container.FindControl("ddlFamilia");
              e.Container.Appointment.Subject = ddlFamilia.Items.FindByValue(ddlFamilia.SelectedValue).Text;
              Appointments.Add(e.Container.Appointment);
          }
          if (e.CommandName == "Update")
          {
              DropDownList ddlFamilia = (DropDownList)e.Container.FindControl("ddlFamilia");
              e.Container.Appointment.Subject = ddlFamilia.Items.FindByValue(ddlFamilia.SelectedValue).Text;
          }
      }
      protected void CarregarComboFamilia(SchedulerFormContainer container)
      {
          DropDownList ddlFamilia = (DropDownList)container.FindControl("ddlFamilia");
          ParameterClassCollection parametros = new ParameterClassCollection();
          parametros.Add(new ParameterClass("IdMicroArea", UCEstruturaRegionalFichaA1.MicroareaSelectedValue));
          EcoArrayList listaFamilia = new Processador().List(typeof(BeFamilia), parametros);
          ddlFamilia.DataSource = listaFamilia.Cast<BeFamilia>().ToList();
          ddlFamilia.DataValueField = "Id";
          ddlFamilia.DataTextField = "Exibicao";
          ddlFamilia.DataBind();
      }

     

    protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)

     

     

      {

     

     

        if (e.Appointment.Visible)

     

     

         {

     

     

           //string id = e.Appointment.ID.ToString();

     

     

           //A alterao de aprazamento permitida somente para ENFERMEIRO e MEDICOS

     

           e.Appointment.AllowEdit =

    true;

     

     

           e.Appointment.AllowDelete =

    true;

     

     

         }   

     

      }



    I don't know what else i can do. Anyone has a idea what could that  be?? Thank's.
  2. Artur
    Artur avatar
    3 posts
    Member since:
    May 2011

    Posted 10 May 2011 Link to this post

    Hi everyone,

    I solved my problem by replace the content of the tag <AdvancedEditTemplate></AdvancedEditTemplate> in this thread http://www.telerik.com/community/forumsajax/scheduler/advancedform-modal-advancededittemplate.aspx
  3. Answer
    Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 10 May 2011 Link to this post

    Hello Artur,

    I'm glad that you resolved the problem on your own.

    Please feel free to ask if you have further questions.

    Greetings,
    Veronica Milcheva
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top