Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
80 views
Hi!

I am in the process of moving from RadControls using .NET2 to .NET4.
The content of the GridTableView.FilterExpression has changed format between .NET2 and .NET4.
In .NET2 the FilterExpression might look like: "([Name] LIKE '%m%')"
In .NET4 the FilterExpression looks like: "(it[\"Name\"].ToString().ToUpper().Contains(\"m\".ToUpper()))"

When a user is working with a grid I am saving the grid settings including filter expressions in database to be used next time. The problem is that when loading settings (filter expression) saved with .NET2 in.NET4 I get a runtime error saying:  Sys.WebForms.PageRequestManagerServerErrorException: Expression expected

Does anyone have a solution for this?

Thanks
/Mats

Mats
Top achievements
Rank 1
 answered on 20 Jan 2011
1 answer
134 views
I am using the NeedDataSource to handle my grid's sorting and paging and I am running into an issue. I do not want my grid to display its records on page load, so I wire up the OnNeedDataSource event handler in the page load when its a postback. Now, I need to distinguish when the user clicks the search button (which calls grid.rebind()) and when the user pages or sorts. I thought I could just check the re-bind reason, but it always states "InitialLoad".  

Any ideas?
Maria Ilieva
Telerik team
 answered on 20 Jan 2011
1 answer
141 views
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


Nikolay Tsenkov
Telerik team
 answered on 20 Jan 2011
1 answer
162 views
I have a pretty simple request, I just can't seem to figure out how to do it =)

I have an AJAXified grid with a GridTemplateColumn defined as follows

<telerik:GridTemplateColumn HeaderText="Request #" DataField="ReqNm" UniqueName="ReqNm"
    Groupable="false" SortExpression="ReqID" AllowFiltering="true" HeaderStyle-Wrap="false"
    ItemStyle-Wrap="false">
    <ItemTemplate>
        <asp:LinkButton ID="btn_ReqID" Text='<%# Eval("ReqID") %>' OnClick="btn_ReqID_Click"
            CommandArgument='<%# Eval("ReqID") %>' runat="server" />
        <br />
        <asp:Label ID="lbl_ReqNm" Text='<%# Eval("ReqNm") %>' runat="server" />
    </ItemTemplate>
    <FilterTemplate>
        <telerik:RadComboBox ID="dd_type_filter" Skin="Default" Width="120px" Font-Size="11px"
            MarkFirstMatch="true" AppendDataBoundItems="true" SelectedValue='<%# (Container as GridItem).OwnerTableView.GetColumn("ReqNm").CurrentFilterValue %>'
            OnClientSelectedIndexChanged="TypeIndexChanged" runat="server">
            <Items>
                <telerik:RadComboBoxItem Text="All" />
            </Items>
        </telerik:RadComboBox>
        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
            <script type="text/javascript">
                function TypeIndexChanged(sender, args) {
                    var tableView = $find("<%# (Container as GridItem).OwnerTableView.ClientID %>");
                    tableView.filter("ReqNm", args.get_item().get_value(), "EqualTo");
                }
            </script>
        </telerik:RadScriptBlock>
    </FilterTemplate>
</telerik:GridTemplateColumn>

In the ItemTemplate, there is a LinkButton that executes the code below:

protected void btn_ReqID_Click(object sender, EventArgs e)
{
    LinkButton btn_ReqID = (LinkButton)sender;
 
    Session["s_ReqID"] = int.Parse(btn_ReqID.CommandArgument.ToString());
 
    string url = "~/eis/request/";
    var AjaxManager = RadAjaxManager.GetCurrent(this.Page);
    AjaxManager.Redirect(url);
}

This is in Sitefinity, so I have to use the AjaxManager to redirect or I get a funky URL. When I click on the LinkButton, I get the LoadingPanel displaying in the center of the grid, then it disappears and the page redirects.

What I'd like to do is to disable the LoadingPanel when these LinkButtons are clicked so that it just redirects like a normal page click.

I have to keep Ajax enabled on the grid though because there are other grid functions that require having Ajax.

Is there a way in the LinkButton click event or in the Grid's ItemDataBound event that I can turn off the loading panel for these LinkButtons?

Thanks =)
Princy
Top achievements
Rank 2
 answered on 20 Jan 2011
2 answers
93 views
Hello,
  
Today I install RadEditorMOSS_4_5_6, I can use RadEditor Web Part ,but RadEdiot not used in List Items.I still see the default editor or a simple textbox after I activate the RadEditor feature! And I had rebot the machine!
alex
Top achievements
Rank 1
 answered on 20 Jan 2011
3 answers
96 views
Hi all,
here my code:
<%@ Page Title="" Language="C#" MasterPageFile="~/DrgiorginiAdmin.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="DrGiorginiAdmin.Default" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Charting" Assembly="Telerik.Web.UI" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentHead" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolder1" runat="server">

        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
            SelectCommand="SELECT * FROM [Category]"></asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
            SelectCommand="SELECT DISTINCT [Year] FROM [Data]"></asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
            SelectCommand="SELECT SC.Name, D.Year, D.Value FROM (Category AS C INNER JOIN Subcategory AS SC ON C.Id=SC.Category_id) INNER JOIN Data AS D ON SC.ID=D.SubCategory_Id WHERE C.ID=@Id ORDER BY C.ID, SC.ID, Year;">
            <SelectParameters>
                <asp:ControlParameter ControlID="dropDownCategory" DefaultValue="2" Name="Id" PropertyName="SelectedValue" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
            SelectCommand="SELECT SUM(Value) AS [Sum], C.Name FROM (Category AS C INNER JOIN Subcategory AS SC ON C.Id=SC.Category_id) INNER JOIN [Data] AS D ON SC.ID=D.SubCategory_Id WHERE [Year]=@Year GROUP BY C.ID, C.Name ORDER BY C.ID">
            <SelectParameters>
                <asp:ControlParameter ControlID="dropDownYears" DefaultValue="1996" Name="Year" PropertyName="SelectedValue" />
            </SelectParameters>
        </asp:SqlDataSource>

        <strong>Binding to a DataSource Control - bar series and grouping</strong><br />
        <label for="dropDownCategory">
            <asp:Label ID="Label2" runat="server" class="text">GDP by Industry:</asp:Label>
        </label>
        <asp:DropDownList ID="dropDownCategory" runat="server" AutoPostBack="true" OnSelectedIndexChanged="dropDownCategory_SelectedIndexChanged"
            Width="225px" DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="Id">
        </asp:DropDownList><br />
        <telerik:RadChart ID="RadChart1" runat="server" Width="710px" OnDataBound="RadChart1_DataBound"
            DataGroupColumn="Name" AutoTextWrap="true" DataSourceID="SqlDataSource3" Skin="LightBlue">
            <Legend>
                <Appearance GroupNameFormat="#VALUE">
                </Appearance>
            </Legend>
            <PlotArea>
                <XAxis DataLabelsColumn="Year">
                </XAxis>
            </PlotArea>
        </telerik:RadChart>
        <br />
        <strong>Binding to a DataSource control - pie series</strong>
        <br />
        <asp:Label ID="Label1" runat="server" class="text">GDP by Year: </asp:Label>
        <asp:DropDownList ID="dropDownYears" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2"
            DataTextField="Year" DataValueField="Year">
        </asp:DropDownList><br />
        <telerik:RadChart ID="RadChart2" runat="server" DefaultType="Pie" Width="710px" AutoTextWrap="true"
            OnItemDataBound="RadChart2_ItemDataBound" DataSourceID="SqlDataSource4" Skin="LightGreen">
            <Appearance Dimensions-Width="710px">
            </Appearance>
            <Series>
                <telerik:ChartSeries Name="Series 1" Type="Pie" DataYColumn="Sum">
                    <Appearance LegendDisplayMode="ItemLabels">
                    </Appearance>
                </telerik:ChartSeries>
            </Series>
        </telerik:RadChart>
        <br />
        <!-- content end -->

</asp:Content>

This page is enclosed inside a MasterPage.
When I change the value in the dropdownlist happen two strange facts (probably a context to another):
part of the layout is modified and after you run the command to change the content to the chart at the bottom right scroll bar begins to load (do not know what).
I know it will be stupid, but because you are noob asking for help.
Thanks in advance!

DrGiorgini
Top achievements
Rank 1
 answered on 20 Jan 2011
7 answers
76 views
I have a scheduler being used for a number of functions, diary, leave etc. In some instances (the majority of browsers) when the cursor is moved over a date it is not always highlighting, and if a double click is made into a day it opens up with the start date of the month shown, not the date that was clicked in.

If the day link is hovered over first then the day highlights, and once this happens some of the other dates also highlight correctly, but not all of them, and it is not consistent.

This seemed to start happening a few Telerik releases ago - currently still shown in 2010.Q3 SP2 release as well.

I can provide a url where this behaviour can be seen if this helps at all.  This is becoming a major issue for some of my customers now who are getting annoyed that they cannot always enter data for the correct date.

David Penny
David Penny
Top achievements
Rank 2
 answered on 20 Jan 2011
2 answers
128 views
Hello,

I have created RadFilterDataFieldEditor by following article: http://www.telerik.com/community/forums/aspnet-ajax/filter/error-when-building-custom-radfilterdatafieldeditor.aspx
It works good if the FilterContainerID property is not set. If I set this property to my RadGrid it does not work correctly.
Editor is shown ok if I add filter expression, but after I click the Apply button, default editor is shown instead RadFilterDataFieldEditor. After next postback I get error with invalid viewstate data.

Here is the Code:
<telerik:RadFilter runat="server" ID="filter" FilterContainerID="articles" ShowApplyButton="true"
    OnFieldEditorCreating="filter_FieldEditorCreating">
    <FieldEditors>
        <telerik:RadFilterTextFieldEditor FieldName="Title" />
        <km:RadFilterDropDownEditor DataSourceID="dsStates" DataTextField="Name" DataValueField="ArticleStatusId"
            FieldName="StatusId" />
        <telerik:RadFilterTextFieldEditor FieldName="AuthorFullName" />
        <telerik:RadFilterNumericFieldEditor FieldName="Rating" />
        <telerik:RadFilterNumericFieldEditor FieldName="TimesRated" />
        <telerik:RadFilterDateFieldEditor FieldName="CreatedDate" />
        <telerik:RadFilterDateFieldEditor FieldName="ModifiedDate" />
    </FieldEditors>
</telerik:RadFilter>
<telerik:RadGrid ID="articles" runat="server" OnNeedDataSource="articles_NeedDataSource"
    EnableLinqExpressions="false" ShowFooter="True" AllowFilteringByColumn="True"
    AllowSorting="True" ShowGroupPanel="True" AllowPaging="true" PageSize="10">
    <MasterTableView AutoGenerateColumns="False" EnableHeaderContextMenu="true" IsFilterItemExpanded="false">
        <Columns>
            <telerik:GridBoundColumn DataField="Title" HeaderText="Title" />
            <telerik:GridDropDownColumn DataField="StatusId" HeaderText="Status" DataSourceID="dsStates" ListTextField="Name" ListValueField="ArticleStatusId" />
            <telerik:GridBoundColumn DataField="AuthorFullName" HeaderText="Author" />
            <telerik:GridBoundColumn DataField="Rating" HeaderText="Rating" />
            <telerik:GridBoundColumn DataField="TimesRated" HeaderText="TimesRated" />
            <telerik:GridBoundColumn DataField="CreatedDate" HeaderText="Created" />
            <telerik:GridBoundColumn DataField="ModifiedDate" HeaderText="Modified" />
        </Columns>
    </MasterTableView>
    <GroupingSettings ShowUnGroupButton="true" CaseSensitive="false" />
    <ClientSettings AllowDragToGroup="True" AllowColumnsReorder="True" />
</telerik:RadGrid>

Codebehind:
protected void filter_FieldEditorCreating(object sender, RadFilterFieldEditorCreatingEventArgs e)
{
    if (e.EditorType == "RadFilterDropDownEditor")
    {
        e.Editor = new RadFilterDropDownEditor();
    }
}

Thank you
Jiri
JiriSchmitt
Top achievements
Rank 1
 answered on 20 Jan 2011
1 answer
142 views
Hi guys,

i'm using the RADFileExplorer control and i'm having some problem with localization.
I need to change the language of the control in my page according with the one of the user (selected from db).
So i added the App_GlobalResources folder to my solution, copied some localized resx files (es: RadEditor.Dialogs.es-ES.resx, RadEditor.Dialogs.it-IT.resx, ecc ...). In the page_load event i set the language radfileexplorer.Language = 'it-IT', for example, but nothing happen! But if i rename the it file to RadEditor.Dialogs.resx the control is translated!
I'm missing something ?

Best regards,
GE
gianemilio redaelli
Top achievements
Rank 1
 answered on 20 Jan 2011
1 answer
48 views
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?