private void BuildGridView(BaseList spList, View spListView)
        {
            this.spGridView.Columns.Clear();
            foreach (string viewFieldName in spListView.FieldNames)
            {
                string fieldName = viewFieldName;
                Field  viewField = spList.Fields.First(field => field.Name == fieldName);
                if (viewField != null)
                {
                    ITemplate     itemTemplate = this.GetItemFieldTemplate(viewField);
                    TemplateField viewFieldColumn;
                    if (!string.IsNullOrEmpty(viewField.HeaderImage))
                    {
                        viewFieldColumn = new TemplateField
                        {
                            ItemTemplate   = itemTemplate,
                            HeaderImageUrl = string.Format("{0}/_layouts/images/{1}", this.Server.Trim(new char[] { '/' }), viewField.HeaderImage),
                            SortExpression = viewField.Name
                        };
                    }
                    else
                    {
                        viewFieldColumn = new TemplateField
                        {
                            ItemTemplate   = itemTemplate,
                            HeaderText     = viewField.DisplayName,
                            SortExpression = viewField.Name
                        };
                    }

                    this.spGridView.Columns.Add(viewFieldColumn);
                }
            }
        }
        protected void spViewsList_IndexChanged(object sender, EventArgs e)
        {
            this.folderPath.Value               = string.Empty;
            this.SortAscending                  = true;
            this.SortExpression                 = string.Empty;
            this.LabelSharepointSite.Text       = this.GetBreadcrumbValue(string.Empty);
            this.spGridView.AutoGenerateColumns = false;
            BaseList spList  = BaseList.GetList(this.Web, this.ListName, this.context);
            View     spView  = View.GetView(spList, this.spViewsList.SelectedValue, this.context);
            var      options = new ItemsRetrievingOptions {
                ViewName = spView.Name
            };

            this.CurrentItems          = new UiItemCollection(this.context, spList, options);
            this.spGridView.DataSource = this.CurrentItems;
            this.BuildGridView(spList, spView);
            this.spGridView.DataBind();
            this.CheckButtons();
        }