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

Error Loading Scheduller

1 Answer 93 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Rodrigo
Top achievements
Rank 1
Rodrigo asked on 17 Jan 2011, 02:31 PM
Hello and sorry for my bad english.
I have an error when i change the selectcommand property in radscheduller.
i have a page with a RadComboBox before the radscheduller. When i selected an item on the RadComboBox i change the select in the RadScheduller at runtime.
The first load from data is ok but when i change the combo i have an exception. Please help me...

The Code aspx Is:

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="uc" TagName="BCComboBox" Src="~/Componentes/BCComboBox.ascx"%>
<%@ Register TagPrefix="uc" TagName="BCNumericTextBox" Src="~/Componentes/BCNumericTextBox.ascx" %>
<%@ Register TagPrefix="uc" TagName="BCTextBox" Src="~/Componentes/BCTextBox.ascx" %>
<%@ Register TagPrefix="uc" TagName="BCChkBox" Src="~/Componentes/BCChkBox.ascx" %>
<%@ Register TagPrefix="uc" TagName="BCLinkButton" Src="~/Componentes/BCLinkButton.ascx" %>
<%@ Register TagPrefix="uc" TagName="BCLabelMain" Src="~/Componentes/BCLabelMain.ascx" %>
<%@ Register TagPrefix="uc" TagName="BCDateTimePicker" Src="~/Componentes/BCDateTimePicker.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<link rel="stylesheet" href="../Css/styles.css" type="text/css" />
     
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div align="center">
        <uc:BCLabelMain ID="lblTitleMain" runat="server" Caption="CALENDARIO" />
    </div>   
    <div align="left">
        <uc:BCComboBox ID="cboSala" runat="server" Caption="Salas:" AutoPostBack="true"/>
     
    </div>
    <div align="center">
    <div id="content">
    <br />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadScheduler1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="CreateAppointment">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
  
    <div class="exampleContainer">
     
                             
        <telerik:RadScheduler runat="server" ID="RadScheduler1"
            DataSourceID="SqlDataSourceTurno" SelectedView="MonthView" OverflowBehavior="Expand"
              DataKeyField = "IdTurno" DataStartField = "Ini"
              DataEndField = "Fin" DataSubjectField = "Asu"
              DataDescriptionField = "Des" MinutesPerRow="15" OnAppointmentInsert="RadScheduler1_AppointmentInsert"
               OnAppointmentUpdate="RadScheduler1_AppointmentUpdate"
            NumberOfHoveredRows="1" AdvancedForm-EnableCustomAttributeEditing="true"
            EnableCustomAttributeEditing="True" Culture="Spanish (Argentina)"
            ShowAllDayRow="false"  StartEditingInAdvancedForm="true"
            OnAppointmentCommand="RadScheduler1_AppointmentCommand"
            OnFormCreated="RadScheduler1_FormCreated"
            OnFormCreating="RadScheduler1_FormCreating"
            onappointmentdatabound="RadScheduler1_AppointmentDataBound"
            ondatabinding="RadScheduler1_DataBinding" ondatabound="RadScheduler1_DataBound">
             
            <localization advancedalldayevent="Todo el Día"
                advancedcalendarcancel="Cancelar" advancedcalendarok="Aceptar"
                advancedcalendartoday="Hoy" advancedclose="Cerrar" advanceddaily="Diariamente"
                advancedday="Día" advanceddays="Día(s)" advanceddescription="Descripción"
                advanceddone="Listo" advancededitappointment="Editar Turno"
                advancedendafter="Fin después de" advancedendbythisdate="Fin por"
                advancedenddaterequired="Fecha Fin requerida"
                advancedendtimerequired="Hora Fin requerida" advancedevery="Todos"
                advancedeveryweekday="Todos los días de la semana" advancedfirst="Primero"
                advancedfourth="Cuarto" advancedfrom="Fecha Inicio" advancedhourly="Por hora"
                advancedhours="Hora(s)" advancedinvalidnumber="Número Inválido"
                advancedlast="último" advancedmaskday="día"
                advancednewappointment="Nuevo Turno" advancedsecond="segundo"
                advancedstartdaterequired="Fecha Inicio requerida"
                advancedstarttimebeforeendtime="Hora de inicio debe ser antes de la hora final"
                advancedstarttimerequired="Hora Inicio requerida" advancedsubject="Asunto"
                advancedsubjectrequired="Ingrese asunto de la cita" advancedthird="Tercero"
                advancedto="Fecha Fin" advancedworking="Trabajando..."
                advancedyearly="Anualmente" allday="Todos los Días" cancel="Cancelar"
                confirmcancel="Cancelar" confirmdeletetext="Está seguro de eliminar esta cita?"
                confirmdeletetitle="Confirma Eliminar" confirmok="Aceptar"
                contextmenuaddappointment="Nuevo turno" contextmenudelete="Eliminar"
                contextmenuedit="Editar" contextmenugototoday="Ir al día" headerday="Día"
                headermonth="Mes" headermultiday="Multi-Día" headernextday="siguiente día"
                headerprevday="anterior día" headertimeline="Línea de Tiempo" headertoday="Hoy"
                headerweek="Semana" save="Guardar" show24hours="Mostrar 24 horas..."
                showadvancedform="Opciones" showbusinesshours="Mostrar Horario de Comercio..."
                showmore="más..." />
              
            <AdvancedForm Modal="true" />
            <TimelineView GroupBy="Calendar" GroupingDirection="Vertical" />
            <TimeSlotContextMenuSettings EnableDefault="true" />
            <AppointmentContextMenuSettings EnableDefault="true" />
         
            <ResourceTypes>
                  
                 <telerik:ResourceType KeyField="IdProducto" Name="IdProducto" TextField="Des" ForeignKeyField="IdProducto"
                DataSourceID="SqlDataSourceProducto" />
                <telerik:ResourceType KeyField="IdCliente" Name="IdCliente" TextField="Nombre" ForeignKeyField="IdCliente"
                DataSourceID="SqlDataSourceCliente" />
            </ResourceTypes>
            
           <%--
            <ResourceStyles>
             
                <telerik:ResourceStyleMapping Type="AppointmentType" Text="technical" ApplyCssClass="rsCategoryGreen" />
             
                <telerik:ResourceStyleMapping Type="AppointmentType" Text="specification_review"ApplyCssClass="rsCategoryOrange" />
             </ResourceStyles> --%>
                 
     
       <AdvancedEditTemplate>
            <div id="qsfexAdvEditWrapper">
                <div id="qsfexAdvEditInnerWrapper" >
                    <div class="qsfexAdvAppType">
                    </div>
                    <div class="qsfexAdvEditControlWrapper">
                         
                        <telerik:RadTextBox runat="server" ID="txtAsunto" Width="100%" Label='<%# RadScheduler1.Localization.AdvancedSubject + ":" %>'
                        Text='<%# Bind("Asu") %>' /><br />
                             
                    </div>
                    <div class="qsfexAdvEditControlWrapper">
                        <asp:Label ID="Label2" AssociatedControlID="StartInput" runat="server" CssClass="inline-label" Text='<%# RadScheduler1.Localization.AdvancedFrom + ":" %>'></asp:Label>
                         
                        <telerik:RadDateInput ID="StartInput" SelectedDate='<%# Bind("Ini") %>' runat="server">
                        </telerik:RadDateInput><br />
                    </div>
                    <div class="qsfexAdvEditControlWrapper">
                        <asp:Label ID="Label3" AssociatedControlID="EndInput" runat="server" CssClass="inline-label" Text="Fecha Fin"></asp:Label>
                        <telerik:RadDateInput ID="EndInput" SelectedDate='<%# Bind("Fin") %>' runat="server">
                        </telerik:RadDateInput><br />
                    </div>
                    <div class="qsfexAdvEditControlWrapper">
                        <div class="inline-label">
                           </div>
                        <div id="qsfexAdvEditColorCodeChooser">
                                
                            <asp:CheckBox ID="chkEstado" runat="server" Text="Estado" DataValueField="IdEstado" DataSourceID="SqlDataSourceTurno" />
                                 
                        </div>
                    </div>
                    <div class="qsfexAdvEditControlWrapper" style="text-align: right;">
                        <asp:LinkButton ID="UpdateButton" runat="server" CommandName="Update">
                            <asp:Image runat="server" ID="insertImage" ImageUrl="../Imagenes/ok.png" AlternateText="Actualizar" /></asp:LinkButton>
                            <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="CommandActualizar"
                                             Style="margin-right: 8px;">
                            <asp:Image runat="server" ID="Image2" ImageUrl="../Imagenes/cancel.png" AlternateText="Cancelar" /></asp:LinkButton>
                    </div>
                </div>
            </div>
        </AdvancedEditTemplate>
         
        </telerik:RadScheduler>
 
      
       
         
        
         <asp:SqlDataSource ID="SqlDataSourceTurno" runat="server"
            ConnectionString="<%$ ConnectionStrings:PuraPielConnectionString2 %>"></asp:SqlDataSource>
            
            <asp:SqlDataSource ID="SqlDataSourceProducto" runat="server"
            ConnectionString="<%$ ConnectionStrings:PuraPielConnectionString2 %>"></asp:SqlDataSource>
            
            <asp:SqlDataSource ID="SqlDataSourceCliente" runat="server"
            ConnectionString="<%$ ConnectionStrings:PuraPielConnectionString2 %>"></asp:SqlDataSource>
         
<%--         <sds:SessionDataSource ID="AppointmentsDataSource" runat="server" DisplayWarning="false"
            PrimaryKeyFields="ID" ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
            SelectCommand="SELECT * FROM [Appointments]" InsertCommand="INSERT INTO [Appointments] ([Subject], [Description], [Start], [End], [RecurrenceRule], [RecurrenceParentID], [Reminder]) VALUES (@Subject, @Description, @Start, @End , @RecurrenceRule, @RecurrenceParentID, @Reminder)"
            UpdateCommand="UPDATE [Appointments] SET [Subject] = @Subject, [Description] = @Description, [Start] = @Start, [End] = @End, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID, [Reminder] = @Reminder WHERE (ID = @ID)"
            DeleteCommand="DELETE FROM [Appointments] WHERE [ID] = @ID">
            <DeleteParameters>
                <asp:Parameter Name="ID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="ID" Type="Int32" />
                <asp:Parameter Name="Subject" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="Start" Type="DateTime" />
                <asp:Parameter Name="End" Type="DateTime" />
                <asp:Parameter Name="RecurrenceRule" Type="String" />
                <asp:Parameter Name="RecurrenceParentID" Type="Int32" />
                <asp:Parameter Name="Reminder" Type="String" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="Subject" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="Start" Type="DateTime" />
                <asp:Parameter Name="End" Type="DateTime" />
                <asp:Parameter Name="RecurrenceRule" Type="String" />
                <asp:Parameter Name="RecurrenceParentID" Type="Int32" />
                <asp:Parameter Name="Reminder" Type="String" />
            </InsertParameters>
        </sds:SessionDataSource>
--%><%--<uc:BCChkBox ID="chkEstado" runat="server" Caption="Activo:" Visible="false" />--%>
    </div>
     
 
    </div
</div>
</asp:Content>



The Code .cs is:

public partial class Calendario : FormGrillaWeb
{
  
 
 #region "Properties"
    private int _idturno;
    private int _idfranquicia;
    private int _idcliente;
    private int _idestado;
    private int _idtipoestado;
    private int _prod;
    private int _sala;
    private string _asu;
    private string _des;
    private DateTime _ini;
    private DateTime _fin;
     
 
    public int IdTurno
    {
        get { return _idturno; }
        set { _idturno = value; }
    }
    public int IdFranquicia
    {
        get { return _idfranquicia; }
        set { _idfranquicia = value; }
    }
    public int IdCliente
    {
        get { return _idcliente; }
        set { _idcliente = value; }
    }
    public int IdSala
    {
        get { return _sala; }
        set { _sala = value; }
    }
    public int IdEstado
    {
        get { return _idestado; }
        set { _idestado = value; }
    }
    public int IdTipoEstado
    {
        get { return _idtipoestado; }
        set { _idtipoestado = value; }
    }
    public int Prod
    {
        get { return _prod; }
        set { _prod = value; }
    }
    public string Asu
    {
        get { return _asu; }
        set { _asu = value; }
    }
    public string Des
    {
        get { return _des; }
        set { _des = value; }
    }
    
    public DateTime Ini
    {
        get { return _ini; }
        set { _ini = value; }
    }
    public DateTime Fin
    {
        get { return _fin; }
        set { _fin = value; }
    }
    
#endregion
     
       
     
    protected override void Page_Load(object sender, EventArgs e)
    {
        AtributoSeguridad = Constantes.AtributoSeguridad.Dueño;
        BCLabelError = lblTitleMain;
        RadScheduler1.DataSource = null;
        RadScheduler1.Appointments.Clear();
        if (!IsPostBack)
        {
            List<SqlParameter> parametros = new List<SqlParameter>();
            parametros.Add(new SqlParameter()
            {
                DbType = DbType.Int32,
                ParameterDirection = ParameterDirection.Input,
                ParameterName = "@IdFranquicia",
                Valor = Convert.ToInt32(Session["IdFranquicia"].ToString()),
            });
            cboSala.LlenarComboClave("FRANQUICIAS_SALAS_COMBO", parametros, Constantes.ComboEmptyText.TODAS);
            cboSalaSelectedindex(null,null);
                
                //RadScheduler1.DataKeyField = "IdTurno";
                //RadScheduler1.DataStartField = "Ini";
                //RadScheduler1.DataEndField = "Fin";
                //RadScheduler1.DataSubjectField = "Asu";
                //RadScheduler1.DataDescriptionField = "Des";
 
                 //Creo el resource(combo) con Productos.
                //ResourceType rt = new ResourceType("IdProducto");
                SqlDataSourceProducto.SelectCommand = "SELECT P.* FROM Productos P, ProductosFranquicia PF WHERE P.IdProducto = PF.IdProducto AND P.IdTipoProducto = 2 AND PF.IdFranquicia = " + Session["IdFranquicia"].ToString();
                //rt.DataSource = SqlDataSourceProducto;
                //rt.KeyField = "IdProducto";
                //rt.ForeignKeyField = "IdProducto";
                //rt.TextField = "Des";
                 
                //RadScheduler1.ResourceTypes.Add(rt);
 
                //Creo el resource(combo) con Clientes.
                //ResourceType rCl = new ResourceType("IdCliente");
                ////  Ver si hay que seleccionar segun la franquicia
               SqlDataSourceCliente.SelectCommand = "SELECT IdCliente,  (Nom + ' ' + Ape) as Nombre FROM Clientes WHERE IdFranquicia = "+ Session["IdFranquicia"].ToString();
                //rCl.DataSource = SqlDataSourceCliente;
                //rCl.KeyField = "IdCliente";
                //rCl.ForeignKeyField = "IdCliente";
                //rCl.TextField = "Nombre";
                 
            
                
            //RadScheduler1.DataSource = SqlDataSource2;
            //command para agregar combo con la sala en formEdit
            //SqlDataSourceProducto.SelectCommand = "SELECT IdSala FROM [FRANQUICIAS_SALAS] WHERE IdFranquicia = " + Session["IdFranquicia"].ToString();
                
          
        }
        this.cboSala.ComboBox.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(cboSalaSelectedindex);
         
         
    }
 
    
 
    protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)
    {
         
        IdTurno = Convert.ToInt32(e.ModifiedAppointment.ID);
        Des = e.ModifiedAppointment.Description.ToString();
        Asu = e.ModifiedAppointment.Subject.ToString();
        Ini = e.ModifiedAppointment.Start;
        Fin = e.ModifiedAppointment.End;
        Prod = Convert.ToInt32(e.ModifiedAppointment.Resources.GetResourceByType("IdProducto").Key);
        IdFranquicia = Convert.ToInt32(Session["IdFranquicia"].ToString());
        IdSala = Convert.ToInt32(cboSala.ComboBox.SelectedValue.ToString());
        IdCliente = Convert.ToInt32(e.ModifiedAppointment.Resources.GetResourceByType("IdCliente").Key);
        //IdEstado = 0;
        IdTipoEstado = 3;
      
    }
 
    protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)
    {
        //IdTurno = Convert.ToInt32(e.Appointment.ID);
        if (Convert.ToInt32(cboSala.ComboBox.SelectedValue.ToString()) != -1)
        {
            Des = e.Appointment.Description.ToString();
            Asu = e.Appointment.Subject.ToString();
            Ini = e.Appointment.Start;
            Fin = e.Appointment.End;
            Prod = Convert.ToInt32(e.Appointment.Resources.GetResourceByType("IdProducto").Key);
            IdFranquicia = Convert.ToInt32(Session["IdFranquicia"].ToString());
            IdSala = Convert.ToInt32(cboSala.ComboBox.SelectedValue.ToString());
            IdCliente = Convert.ToInt32(e.Appointment.Resources.GetResourceByType("IdCliente").Key);
            IdEstado = 0;
            IdTipoEstado = 3;
 
            this.EjecutarComandoInsert();
            this.setearMensaje("Turno cargado correctamente", Constantes.ColorMensaje.Correcto);
 
        }
        else
        {
            this.setearMensaje("Debe seleccionar una Sala", Constantes.ColorMensaje.InCorrecto);
        }
      
 
 
 
    }
    protected override void setearMensaje(string mensaje, string color)
    {
        base.setearMensaje(mensaje, color);
    }
    
    private void EjecutarComandoUpdate()
    {
        List<SqlParameter> parametros = new List<SqlParameter>();
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.Int32,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@IdTurno",
            Valor = IdTurno,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.String,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@Asu",
            Valor = Asu,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.String,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@Des",
            Valor = Des,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.Int32,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@IdCliente",
            Valor = IdCliente,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.Int32,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@IdProducto",
            Valor = Prod,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.Int32,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@IdFranquicia",
            Valor = IdFranquicia,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.Int32,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@IdSala",
            Valor = IdSala,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.DateTime,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@Ini",
            Valor = Ini,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.DateTime,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@Fin",
            Valor = Fin,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.Int32,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@IdEstado",
            Valor = IdEstado,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.Int32,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@IdTipoEstado",
            Valor = IdTipoEstado,
        });
 
 
        DataBase dataBase = new DataBase();
        dataBase.ExecuteReader(Constantes.procedures.TurnosUpdate, parametros);
 
 
    }
    private void EjecutarComandoInsert()
    {
        List<SqlParameter> parametros = new List<SqlParameter>();
        
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.String,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@Asu",
            Valor = Asu,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.String,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@Des",
            Valor = Des,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.Int32,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@IdCliente",
            Valor = IdCliente,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.Int32,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@IdProducto",
            Valor = Prod,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.Int32,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@IdFranquicia",
            Valor = IdFranquicia,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.Int32,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@IdSala",
            Valor = IdSala,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.DateTime,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@Ini",
            Valor = Ini,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.DateTime,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@Fin",
            Valor = Fin,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.Int32,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@IdEstado",
            Valor = IdEstado,
        });
        parametros.Add(new SqlParameter()
        {
            DbType = DbType.Int32,
            ParameterDirection = ParameterDirection.Input,
            ParameterName = "@IdTipoEstado",
            Valor = IdTipoEstado,
        });
 
 
        DataBase dataBase = new DataBase();
        dataBase.ExecuteReader(Constantes.procedures.TurnosAlta, parametros);
 
 
    }
    //protected void CreateAppointment_Click(object sender, EventArgs e)
    //{
       
 
    //}
 
    protected void cboSalaSelectedindex(object sender, EventArgs e)
    {
        
        int sala = Convert.ToInt32(cboSala.ComboBox.SelectedValue.ToString());
         
        if (sala != -1)
        {
         SqlDataSourceTurno.SelectCommand = "SELECT * FROM [Turnos] WHERE IdSala = " + sala.ToString() + " AND IdFranquicia = " + Session["IdFranquicia"].ToString();
        }
        else
        {
         SqlDataSourceTurno.SelectCommand = "SELECT * FROM [Turnos] WHERE IdFranquicia = " + Session["IdFranquicia"].ToString();
        }
    }
 
 
 
    protected void RadScheduler1_AppointmentCommand(object sender, AppointmentCommandEventArgs e)
    {
        //if (e.CommandName == "Insert" || e.CommandName == "Update")
        //{
        //    CheckBox repeatCheck = e.Container.FindControl("RepeatCheckBox") as CheckBox;
        //    if (repeatCheck != null)
        //    {
        //        if (repeatCheck.Checked)
        //        {
        //            RecurrenceRange range = new RecurrenceRange();
        //            range.Start = RadScheduler1.DisplayToUtc(e.Container.Appointment.Start);
        //            range.EventDuration = e.Container.Appointment.Duration;
        //            range.MaxOccurrences = 10;
        //            DailyRecurrenceRule rule = new DailyRecurrenceRule(1, range);
        //            e.Container.Appointment.RecurrenceRule = rule.ToString();
        //        }
        //        else
        //        {
        //            e.Container.Appointment.RecurrenceRule = string.Empty;
        //        }
        //    }
        //}
    }
 
    protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
    {
        //RadScheduler scheduler = (RadScheduler)sender;
 
 
 
        //if (e.Container.Mode == SchedulerFormMode.AdvancedInsert || e.Container.Mode == SchedulerFormMode.AdvancedEdit)
        //{
        //    TextBox subjectBox = (TextBox)e.Container.FindControl("TitleTextBox");
        //    subjectBox.Text = e.Appointment.Subject;
 
        //    RadDateInput startInput = (RadDateInput)e.Container.FindControl("StartInput");
        //    startInput.DateFormat = scheduler.AdvancedForm.DateFormat + " " + scheduler.AdvancedForm.TimeFormat;
        //    startInput.SelectedDate = RadScheduler1.DisplayToUtc(e.Appointment.Start);
 
        //    RadDateInput endInput = (RadDateInput)e.Container.FindControl("EndInput");
        //    endInput.DateFormat = scheduler.AdvancedForm.DateFormat + " " + scheduler.AdvancedForm.TimeFormat;
        //    endInput.SelectedDate = RadScheduler1.DisplayToUtc(e.Appointment.End);
 
        //    CheckBox repeatCheck = e.Container.FindControl("RepeatCheckBox") as CheckBox;
        //    if (repeatCheck != null)
        //    {
        //        repeatCheck.Checked = e.Appointment.RecurrenceState == RecurrenceState.Master;
        //    }
        //}
    }
 
    protected void RadScheduler1_FormCreating(object sender, SchedulerFormCreatingEventArgs e)
    {
        //if (e.Mode == SchedulerFormMode.Insert || e.Mode == SchedulerFormMode.AdvancedInsert)
        //{
        //    e.Appointment.Resources.Add(RadScheduler1.Resources.GetResourceByType("AppointmentType"));
        //}
    }
 
    protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
    {
 
    }
 
    protected void RadScheduler1_DataBound(object sender, EventArgs e)
    {
 
    }
 
    protected void RadScheduler1_DataBinding(object sender, EventArgs e)
    {
 
    }
  
 
 
}


The Error when execute cboSalaSelectedindex is:

Referencia a objeto no establecida como instancia de un objeto.
Descripción: Excepción no controlada al ejecutar la solicitud Web actual. Revise el seguimiento de la pila para obtener más información acerca del error y dónde se originó en el código.
 
Detalles de la excepción: System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.
 
Error de código fuente:
 
Se ha generado una excepción no controlada durante la ejecución de la solicitud Web actual. La información sobre el origen y la ubicación de la excepción pueden identificarse utilizando la excepción del seguimiento de la pila siguiente.
 
Seguimiento de la pila:
 
[NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.]
   Telerik.Web.UI.ResourceTypeControl.PerformDataBinding(IEnumerable data) +246
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +114
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
   Telerik.Web.UI.RadScheduler.BindResourcesFromDataSource() +635
   Telerik.Web.UI.RadScheduler.PerformSelect() +279
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
   Telerik.Web.UI.RadScheduler.EnsureDataBound() +30
   Telerik.Web.UI.RadScheduler.CreateChildControls(Boolean bindFromDataSource) +131
   Telerik.Web.UI.RadScheduler.CreateChildControls() +34
   System.Web.UI.Control.EnsureChildControls() +87
   Telerik.Web.UI.RadScheduler.OnPreRender(EventArgs e) +119
   System.Web.UI.Control.PreRenderRecursiveInternal() +80
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

Than you very much


1 Answer, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 20 Jan 2011, 12:56 PM
Hello Rodrigo,

Please, open a support ticket and send us a sample project reproducing the behavior you specify.

Also, please, try to isolate only the relevant to the problem code (while the example is still runnable) which reproduces the issue.

And finally, the exception you sent is not in English, which is the official language in our support and forum threads. If you provide us with the above mentioned project, we will not need the exception (since we can see it for ourselves at our end), but otherwise you will have to change the localization settings to show the exception in English.
Thanks!


Regards,
Nikolay Tsenkov
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.
Tags
Scheduler
Asked by
Rodrigo
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Share this question
or