Hello,
I am initializing the RadFIlter component from Server side. After initializing, I am loading the collection list into the component. In the front end, whenever I am clicking on the item of the list, it works fine. There is a refresh interval timeout (5 seconds). After every 5 seconds, I am loading the values from the database on the front end grid.
So whenever I click on any Radfilter items after 5 seconds refresh interval, the error window appears which says "index was out of range. must be nonnegative and less than the size of the collection List". Within the 5 seconds interval, it works fine. It seems the values which I am loading on the server side are getting lost.
I am performing the following steps;
I request to the Telerik expertise, to tell me what I am doing wrong. Why the Telerik object is getting lost due the front end refresh time interval.
                                I am initializing the RadFIlter component from Server side. After initializing, I am loading the collection list into the component. In the front end, whenever I am clicking on the item of the list, it works fine. There is a refresh interval timeout (5 seconds). After every 5 seconds, I am loading the values from the database on the front end grid.
So whenever I click on any Radfilter items after 5 seconds refresh interval, the error window appears which says "index was out of range. must be nonnegative and less than the size of the collection List". Within the 5 seconds interval, it works fine. It seems the values which I am loading on the server side are getting lost.
I am performing the following steps;
1. On the page initialization, I am creating the Rad FIlter Component.
 this.ComplexFilter = new RadFilter()
                    {
                        ID = "ComplexFilter",
                           AllowFilterOnBlur = true,
                          ShowApplyButton = false,
                          Skin = "Vista",
                          EnableViewState = false
                                           
                    };
this.ComplexFilter.ItemCommand += this.ComplexFilter_OnItemCommand;
this.ComplexFilterPanel.ContentTemplateContainer.Controls.Add(this.ComplexFilter);
fieldEditor.FieldName = column.JsName; // column is the list of items. This I am doing for every column list item.
fieldEditor.DisplayName = column.Name;
 fieldEditor.DataType = column.Type;
this.ComplexFilter.FieldEditors.Add(fieldEditor);
 
var rootGroup = this.Settings.ComplexFilter_Expression;
 if (rootGroup != null)
                {
                    this.ComplexFilter.RootGroup.GroupOperation = rootGroup.GroupOperation;
                     foreach (var expression in rootGroup.Expressions)
                    {
                        this.ComplexFilter.RootGroup.AddExpression(expression);
                    }
                } 
                this.ComplexFilter.PreRender += this.ComplexFilter_OnPreRender;
  
void ComplexFilter_OnUpdate(object sender, EventArgs args)
        {
            string previousComplexFilterSql;
             string newComplexFilterSql; 
            if (this.Settings.ComplexFilter_Sql != null)
            {
                previousComplexFilterSql = this.Settings.ComplexFilter_Sql;
            }
            else
            {
                if (this.Settings.ComplexFilter_Expression != null)
                {
                    previousComplexFilterSql = this.Settings.ComplexFilter_Expression.ToWhere(this.TablesTable).ToString();
                }
                else
                {
                    previousComplexFilterSql = String.Empty;
                }
            } 
            if (this.Settings.ComplexFilter_Visible)
            {
                this.Settings.ComplexFilter_Expression = this.ComplexFilter.RootGroup;
 
                newComplexFilterSql = this.Settings.ComplexFilter_Sql = this.Settings.ComplexFilter_Expression.ToWhere(this.TablesTable).ToString();
            }
            else
            {
                newComplexFilterSql = String.Empty;
            } 
            this.ComplexFilter_ReloadData(previousComplexFilterSql, newComplexFilterSql); 
            ComplexFilter.RecreateControl(); 
        }
 
  2. After every 5 seconds Refresh timeout, I am checking for the complex filter saved settings. But due to the null value of ComplexFilter_Expression, settings could not be fetched from the database.
   if (this.ComplexFilter_Visible && this.ComplexFilter_Expression != null)
            {
                where &= this.ComplexFilter_Expression.GetDBWhere(table, joins, out saveSettings); 
            }
            else
            {
                saveSettings = false;
            }
I request to the Telerik expertise, to tell me what I am doing wrong. Why the Telerik object is getting lost due the front end refresh time interval.
