Пример #1
0
        /// <summary>
        /// Binds the extender columns.
        /// </summary>
		private void BindExtenderColumns()
		{
			List<GridViewColumnInfo> ciCollection = new List<GridViewColumnInfo>();

			// fill GridViewColumnInfo collection
			AdminView view = MainListView.GetAdminView();
			if (view != null)
			{
				// get settings
				string gridSettingsKey = CMPageSettings.MakeGridSettingsKey(this.AppId, this.ViewId);
				string oldGridSettings = ProfileContext.Current.Profile.PageSettings.GetSettingString(gridSettingsKey);
				EcfListViewPreferences prefs = null;
				if (!String.IsNullOrEmpty(oldGridSettings))
					prefs = UtilHelper.JsonDeserialize<EcfListViewPreferences>(oldGridSettings);

				// set columns' properties
				gvHeaderExtender.ColumnsInfo.Clear();
				foreach (ViewColumn viewColumn in view.Columns)
				{
					if (!viewColumn.Visible)
						continue;

					GridViewColumnInfo gvColumn = new GridViewColumnInfo();
					gvColumn.Sortable = viewColumn.ColumnType == ColumnType.Action ? false : viewColumn.AllowSorting;
					gvColumn.Resizable =
						viewColumn.ColumnType == ColumnType.CheckBox || viewColumn.ColumnType == ColumnType.Action ?
						false : viewColumn.Resizable;
					int width = 0;
					if (viewColumn.ColumnType == ColumnType.CheckBox)
						// checkbox column should be of fixed width
						width = EcfListView.DefaultCheckboxColumnWidth;
					else
					{
						// set width
						if (prefs != null && prefs.ColumnProperties[viewColumn.ColumnIndex.ToString()] != null)
							width = Int32.Parse((string)prefs.ColumnProperties[viewColumn.ColumnIndex.ToString()]);
						else if (!Int32.TryParse(viewColumn.Width, out width))
							width = EcfListView.DefaultColumnWidth;
					}
					gvColumn.Width = width;

					gvHeaderExtender.ColumnsInfo.Add(gvColumn);
				}
			}

			this.gvHeaderExtender.HeaderHeight = EcfListView.DefaultHeaderHeight;

			this.gvHeaderExtender.StyleInfo = new Mediachase.Ibn.Web.UI.WebControls.GridStylesInfo(MainListView.HeaderCssClass, MainListView.GridCssClass, MainListView.FooterCssClass, MainListView.HeaderInnerCssClass, MainListView.GridInnerCssClass, MainListView.GridSelectedRowCssClass);
		}
Пример #2
0
        private void BindExtenderColumns()
        {
            List <GridViewColumnInfo> list = new List <GridViewColumnInfo>();
            AdminView adminView            = this.MainListView.GetAdminView();

            if (adminView != null)
            {
                CMPageSettings.MakeGridSettingsKey(this.AppId, this.ViewId);
                string input = string.Empty;
                EcfListViewPreferences listViewPreferences = (EcfListViewPreferences)null;
                if (!string.IsNullOrEmpty(input))
                {
                    listViewPreferences = UtilHelper.JsonDeserialize <EcfListViewPreferences>(input);
                }
                this.gvHeaderExtender.ColumnsInfo.Clear();
                foreach (ViewColumn viewColumn in (CollectionBase)adminView.Columns)
                {
                    if (viewColumn.Visible)
                    {
                        GridViewColumnInfo gridViewColumnInfo = new GridViewColumnInfo();
                        gridViewColumnInfo.Sortable  = viewColumn.ColumnType != ColumnType.Action && viewColumn.AllowSorting;
                        gridViewColumnInfo.Resizable = viewColumn.ColumnType != ColumnType.CheckBox && viewColumn.ColumnType != ColumnType.Action && viewColumn.Resizable;
                        int result = 0;
                        if (viewColumn.ColumnType == ColumnType.CheckBox)
                        {
                            result = 24;
                        }
                        else if (listViewPreferences != null && listViewPreferences.ColumnProperties[(object)viewColumn.ColumnIndex.ToString()] != null)
                        {
                            result = int.Parse((string)listViewPreferences.ColumnProperties[(object)viewColumn.ColumnIndex.ToString()]);
                        }
                        else if (!int.TryParse(viewColumn.Width, out result))
                        {
                            result = 100;
                        }
                        gridViewColumnInfo.Width = result;
                        this.gvHeaderExtender.ColumnsInfo.Add(gridViewColumnInfo);
                    }
                }
            }
            this.gvHeaderExtender.HeaderHeight = 24;
            this.gvHeaderExtender.StyleInfo    = new GridStylesInfo(this.MainListView.HeaderCssClass, this.MainListView.GridCssClass, this.MainListView.FooterCssClass, this.MainListView.HeaderInnerCssClass, this.MainListView.GridInnerCssClass, this.MainListView.GridSelectedRowCssClass);
        }