コード例 #1
0
ファイル: Sorting.cs プロジェクト: xyAndroid/PhoneServer
        private void ApplyStyle()
        {
            if (this.CommandRenderMode == SortingCommandRenderMode.Button)
            {
                if (_commandStyle != null)
                {
                    _btnAdd.ApplyStyle(CommandStyle);
                    _btnDelete.ApplyStyle(CommandStyle);
                    _btnUp.ApplyStyle(CommandStyle);
                    _btnDown.ApplyStyle(CommandStyle);
                    _btnClear.ApplyStyle(CommandStyle);
                    _btnOK.ApplyStyle(CommandStyle);
                }
            }
            else if (this.CommandRenderMode == SortingCommandRenderMode.ImageButton)
            {
                _imgBtnAdd.ApplyStyle(CommandStyle);
                _imgBtnDelete.ApplyStyle(CommandStyle);
                _imgBtnUp.ApplyStyle(CommandStyle);
                _imgBtnDown.ApplyStyle(CommandStyle);
                _imgBtnOK.ApplyStyle(CommandStyle);
            }

            if (this.SetSortingFieldsRenderMode == SortingSetSortingFieldsRenderMode.ListBox)
            {
                _lstBoxSetSortingFields.ApplyStyle(SetSortingFieldsStyle);
            }
            else if (this.SetSortingFieldsRenderMode == SortingSetSortingFieldsRenderMode.RadioButtonList)
            {
                _rdoBtnLstSetSortingFields.ApplyStyle(SetSortingFieldsStyle);
            }

            if (_sortingFieldsStyle != null)
            {
                _ddlstSortingFields.ApplyStyle(_sortingFieldsStyle);
            }

            if (_sortDirectionStyle != null)
            {
                _rdoBtnLstSortDirection.ApplyStyle(_sortDirectionStyle);
            }
        }
コード例 #2
0
        protected override void CreateChildControls()
        {
#if true
            var label = new Label {
                ID = "FilterLabel", Text = "Фильтр:"
            };
            this.Controls.Add(label);

            AttributeListBox = new ListBox()
            {
                SelectionMode   = ListSelectionMode.Multiple,
                Width           = 450,
                Height          = Unit.Pixel(450),
                ID              = "AttributeListBox",
                EnableViewState = true
            };

#if alexj
            AttributeListBox.Attributes.Add("style", "overflow-x:auto;");
#endif


            if (isFromAdministration == true)
            {
                AttributeListBox.Height = Unit.Point(200);
            }

            AttributeFilterBox = new TextBox {
                ID = "AttributeFilterBox", AutoPostBack = false, EnableViewState = true, ViewStateMode = System.Web.UI.ViewStateMode.Enabled
            };
            //AttributeFilterBox.TextChanged += new System.EventHandler(AttributeFilterBox_TextChanged);
            AttributeFilterBox.Attributes["onkeyup"] = string.Format("keyup_handlerFilterControl(this, '{0}')", AttributeListBox.ClientID);

            if (isFromAdministration == true)
            {
                AttributeListBox.DataSource = GetAttributesForAdministration();
            }
            else if (isInputExcelBased)
            {
                AttributeListBox.DataSource = GetAttributesForInputExcelBased();
            }
            else
            {
                AttributeListBox.DataSource = GetAttributes();
            }


            AttributeListBox.DataTextField  = "name";
            AttributeListBox.DataValueField = "id";
            AttributeListBox.DataBind();

#if alexj
            //Делаем что бы выплывали подсказки при наведении на атрибут в AttributeListBox
            foreach (ListItem item in AttributeListBox.Items)
            {
                item.Attributes["title"] = item.Text;
            }
#endif

#if alexj
            //Делаем что бы показывало только разрешенные Entity
#endif

            this.Controls.Add(AttributeFilterBox);

            var br = new HtmlGenericControl("br");
            this.Controls.Add(br);

            if (AttributeBoxStyle != null)
            {
                AttributeListBox.ApplyStyle(AttributeBoxStyle);
            }


            this.Controls.Add(AttributeListBox);
#else
            this.Controls.Clear();
            var c   = ScriptManager.GetCurrent(this.Page);
            var col = c.Controls;

            var filterPanel = new UpdatePanel {
                ID = "FilterPanel", UpdateMode = UpdatePanelUpdateMode.Conditional, ChildrenAsTriggers = false
            };


            var label = new Label {
                ID = "FilterLabel", Text = "Фильтр:"
            };
            filterPanel.ContentTemplateContainer.Controls.Add(label);

            AttributeFilterBox = new TextBox {
                ID = "AttributeFilterBox", AutoPostBack = true, EnableViewState = true, ViewStateMode = System.Web.UI.ViewStateMode.Enabled
            };
            AttributeFilterBox.TextChanged          += new System.EventHandler(AttributeFilterBox_TextChanged);
            AttributeFilterBox.Attributes["onkeyup"] = "keyup_handler2(this)";
            filterPanel.ContentTemplateContainer.Controls.Add(AttributeFilterBox);
            this.Controls.Add(filterPanel);


            var br = new HtmlGenericControl("br");
            this.Controls.Add(br);

            var attributePanel = new UpdatePanel {
                ID = "AttributePanel"
            };
            AttributeBox = new ListBox()
            {
                SelectionMode = ListSelectionMode.Multiple, Width = 450, ID = "AttributeListBox", Height = Unit.Point(450), EnableViewState = true
            };
            AttributeBox.DataSource     = GetAttributes();
            AttributeBox.DataTextField  = "name";
            AttributeBox.DataValueField = "id";
            AttributeBox.DataBind();
            attributePanel.ContentTemplateContainer.Controls.Add(AttributeBox);

            this.Controls.Add(attributePanel);
#endif
        }