// All the private methods.
        #region Private Methods
        /// <summary>
        /// Builds the information panel content.
        /// </summary>
        /// <param name="cell">The table cell.</param>
        /// <param name="designTime">Specify if we need the design time string.</param>
        internal override void BuildInfo(TableCell cell, bool designTime)
        {
            /*string info = InfoTemplate;
             *
             * System.Web.UI.WebControls.Label infoText = new System.Web.UI.WebControls.Label();
             * infoText.Text = info;*/

            if (this.PagerFilters.Count > 0)
            {
                DropDownList _dropDownList = new DropDownList();
                _dropDownList.SelectedIndexChanged += new EventHandler(OnFilter_Select);
                _dropDownList.DataSource            = this.PagerFilters;
                _dropDownList.DataTextField         = "Label";
                _dropDownList.DataValueField        = "Key";
                _dropDownList.DataBind();
                _dropDownList.ID           = "_pageFilters";
                _dropDownList.AutoPostBack = true;
                _dropDownList.ApplyStyle(this.SelectorStyle);

                if (this.CurrentFilter != null)
                {
                    _dropDownList.Items.FindByValue(this.CurrentFilter.Key).Selected = true;
                }

                cell.Controls.Add(_dropDownList);
            }
        }
Пример #2
0
        /// <summary>
        /// Initializes and Adds Condition DropDownList to Current table cell.
        /// </summary>
        /// <param name="control">Current RableCell</param>
        private void BuildConditionDropDown(Control control)
        {
            DropDownList conditionDropDown = new DropDownList();

            conditionDropDown.ID = _Condition;
            conditionDropDown.ApplyStyle(InputControlStyle);

            IParserAccessor access = control as IParserAccessor;

            access.AddParsedSubObject(conditionDropDown);
        }
Пример #3
0
        private void BuildOperatorDropDown(Control control)
        {
            DropDownList operatorDropDown = new DropDownList();

            operatorDropDown.ID = _Operator;
            operatorDropDown.ApplyStyle(InputControlStyle);

            IParserAccessor access = control as IParserAccessor;

            access.AddParsedSubObject(operatorDropDown);
        }
Пример #4
0
        /// <summary>
        /// Initializes and Adds Property DropDownList to Current table cell.
        /// </summary>
        /// <param name="control">Current RableCell</param>
        private void BuildPropertyDropDown(Control control)
        {
            DropDownList propertyDropDown = new DropDownList();

            propertyDropDown.ID           = _Property;
            propertyDropDown.AutoPostBack = true;
            propertyDropDown.ApplyStyle(InputControlStyle);
            propertyDropDown.SelectedIndexChanged += new EventHandler(PropertyDropDownList_SelectedIndexChanged);

            IParserAccessor access = control as IParserAccessor;

            access.AddParsedSubObject(propertyDropDown);
        }
Пример #5
0
            protected internal override void Render(HtmlTextWriter writer)
            {
                // Needed for designtime
                EnsureChildControls();

                _value.ApplyStyle(ControlStyle);
                _value.RenderControl(writer);

                writer.Write("&nbsp;");

                _type.ApplyStyle(ControlStyle);
                _type.RenderControl(writer);
            }
Пример #6
0
        protected override void RenderFooter(HtmlTextWriter writer)
        {
            writer.AddStyleAttribute(HtmlTextWriterStyle.Margin, "4px");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            DropDownList list = new DropDownList {
                ClientIDMode = ClientIDMode.AutoID,
                ID           = this.ZonesID
            };

            if (base.DesignMode)
            {
                list.Items.Add(System.Web.SR.GetString("Zone_SampleHeaderText"));
            }
            else if ((base.WebPartManager != null) && (base.WebPartManager.Zones != null))
            {
                foreach (WebPartZoneBase base2 in base.WebPartManager.Zones)
                {
                    if (base2.AllowLayoutChange)
                    {
                        ListItem item = new ListItem(base2.DisplayTitle, base2.ID);
                        if (string.Equals(base2.ID, this._selectedZoneID, StringComparison.OrdinalIgnoreCase))
                        {
                            item.Selected = true;
                        }
                        list.Items.Add(item);
                    }
                }
            }
            base.LabelStyle.AddAttributesToRender(writer, this);
            if (list.Items.Count > 0)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.For, list.ClientID);
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Label);
            writer.Write(this.SelectTargetZoneText);
            writer.RenderEndTag();
            writer.Write("&nbsp;");
            list.ApplyStyle(base.EditUIStyle);
            if (list.Items.Count > 0)
            {
                list.RenderControl(writer);
            }
            writer.Write("&nbsp;");
            this.RenderVerbs(writer);
            writer.RenderEndTag();
        }
Пример #7
0
        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);
            }
        }
Пример #8
0
        protected override void RenderFooter(HtmlTextWriter writer)
        {
            writer.AddStyleAttribute(HtmlTextWriterStyle.Margin, "4px");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            DropDownList zonesDropDownList = new DropDownList();

            zonesDropDownList.ClientIDMode = ClientIDMode.AutoID;
            zonesDropDownList.ID           = ZonesID;

            // Populate the DropDownList
            if (DesignMode)
            {
                // Add sample zone to dropdown
                zonesDropDownList.Items.Add(SR.GetString(SR.Zone_SampleHeaderText));
            }
            else
            {
                if (WebPartManager != null && WebPartManager.Zones != null)
                {
                    foreach (WebPartZoneBase zone in WebPartManager.Zones)
                    {
                        if (zone.AllowLayoutChange)
                        {
                            Debug.Assert(!String.IsNullOrEmpty(zone.ID));
                            ListItem item = new ListItem(zone.DisplayTitle, zone.ID);
                            if (String.Equals(zone.ID, _selectedZoneID, StringComparison.OrdinalIgnoreCase))
                            {
                                item.Selected = true;
                            }
                            zonesDropDownList.Items.Add(item);
                        }
                    }
                }
            }

            LabelStyle.AddAttributesToRender(writer, this);
            // Only render the "for" attribute if we are going to render the associated DropDownList (VSWhidbey 541458)
            if (zonesDropDownList.Items.Count > 0)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.For, zonesDropDownList.ClientID);
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Label);
            writer.Write(SelectTargetZoneText);
            writer.RenderEndTag();

            // Render &nbsp; before the DropDownList (VSWhidbey 77709)
            writer.Write("&nbsp;");

            zonesDropDownList.ApplyStyle(EditUIStyle);
            // Do not render empty DropDownList (VSWhidbey 534498)
            if (zonesDropDownList.Items.Count > 0)
            {
                zonesDropDownList.RenderControl(writer);
            }

            writer.Write("&nbsp;");

            RenderVerbs(writer);

            writer.RenderEndTag();  // Div
        }
        /// <summary>
        /// Builds the navigation.
        /// </summary>
        /// <param name="cell">The cell.</param>
        internal override void BuildNavigation(TableCell cell)
        {
            string navigationTemplate = (this.RecordCount == 0 && !string.IsNullOrEmpty(NavigationTemplateNoRecords) ? NavigationTemplateNoRecords : NavigationTemplate);

            // Prepare the navigation template for parsing
            string strongSeparator = "{nctrl}";

            navigationTemplate = navigationTemplate.Replace("$PAGESIZES$", "{nctrl}$PAGESIZE${nctrl}");
            navigationTemplate = navigationTemplate.Replace("$PREVIOUSPAGE$", "{nctrl}$PREVIOUSPAGE${nctrl}");
            navigationTemplate = navigationTemplate.Replace("$FIRSTPAGE$", "{nctrl}$FIRSTPAGE${nctrl}");
            navigationTemplate = navigationTemplate.Replace("$PAGESELECTOR$", "{nctrl}$PAGESELECTOR${nctrl}");
            navigationTemplate = navigationTemplate.Replace("$PAGEGROUP$", "{nctrl}$PAGEGROUP${nctrl}");
            navigationTemplate = navigationTemplate.Replace("$LASTPAGE$", "{nctrl}$LASTPAGE${nctrl}");
            navigationTemplate = navigationTemplate.Replace("$NEXTPAGE$", "{nctrl}$NEXTPAGE${nctrl}");

            string[] stringSeparators = new string[] { strongSeparator };

            // Parse
            foreach (string templateItem in navigationTemplate.Split(stringSeparators, StringSplitOptions.None))
            {
                switch (templateItem)
                {
                case "$PAGESIZES$":
                    if (this.PageSizes != string.Empty)
                    {
                        DropDownList pageSizeSelector = new DropDownList();

                        pageSizeSelector.ApplyStyle(this.SelectorStyle);

                        foreach (string pageSize in this.PageSizes.Split(','))
                        {
                            ListItem item = new ListItem(pageSize, pageSize);
                            if (pageSize == this.PageSize.ToString())
                            {
                                item.Selected = true;
                            }

                            pageSizeSelector.Items.Add(item);
                        }

                        pageSizeSelector.AutoPostBack          = true;
                        pageSizeSelector.SelectedIndexChanged += new EventHandler(OnPageSize_Changed);
                        cell.Controls.Add(pageSizeSelector);
                    }
                    break;

                case "$PREVIOUSPAGE$":
                    LinkButton previous = new LinkButton();
                    if (this.CurrentIndex == 0)
                    {
                        previous.Enabled = false;
                    }
                    previous.CausesValidation = this.CausesValidation;
                    previous.Click           += new EventHandler(OnPreviousPage_Click);
                    previous.Text             = PreviousText;
                    cell.Controls.Add(previous);
                    break;

                case "$NEXTPAGE$":
                    // Next
                    LinkButton next = new LinkButton();
                    if (CurrentIndex >= RecordCount - PageSize)
                    {
                        next.Enabled = false;
                    }
                    next.CausesValidation = CausesValidation;
                    next.Click           += new EventHandler(OnNextPage_Click);
                    next.Text             = NextText;
                    cell.Controls.Add(next);
                    break;

                case "$FIRSTPAGE$":
                    if (!this.FirstLastDisabled)
                    {
                        // First
                        System.Web.UI.WebControls.LinkButton first = new System.Web.UI.WebControls.LinkButton();
                        if (this.CurrentIndex == 0)
                        {
                            first.Enabled = false;
                        }
                        first.CausesValidation = CausesValidation;
                        first.Click           += new EventHandler(OnFirstPage_Click);
                        first.Text             = _firstText;
                        cell.Controls.Add(first);
                    }
                    break;

                case "$LASTPAGE$":
                    if (!this.FirstLastDisabled)
                    {
                        // Last
                        System.Web.UI.WebControls.LinkButton last = new System.Web.UI.WebControls.LinkButton();
                        if (CurrentIndex >= RecordCount - PageSize)
                        {
                            last.Enabled = false;
                        }
                        last.CausesValidation = CausesValidation;
                        last.Click           += new EventHandler(OnLastPage_Click);
                        last.Text             = _lastText;
                        cell.Controls.Add(last);
                    }
                    break;

                case "$PAGESELECTOR$":
                    if (this.PageSelectorEnabled)
                    {
                        System.Web.UI.WebControls.DropDownList pageSelector = new System.Web.UI.WebControls.DropDownList();

                        pageSelector.ApplyStyle(this.SelectorStyle);

                        for (int index = 1; index <= this.PageCount; index++)
                        {
                            ListItem item = new ListItem(index.ToString(), index.ToString());
                            if (index == this.CurrentPage)
                            {
                                item.Selected = true;
                            }

                            pageSelector.Items.Add(item);
                        }

                        pageSelector.AutoPostBack          = true;
                        pageSelector.SelectedIndexChanged += new EventHandler(OnGotoPage_Click);
                        cell.Controls.Add(pageSelector);
                    }
                    break;

                case "$PAGEGROUP$":
                    if (!this.PageGroupDisabled)
                    {
                        // Calculate start & end positions
                        int start, end, index;

                        start = CurrentPage - 2;     // autoshift page groups

                        if (start < 1)
                        {
                            start = 1;     // but only for page selection over the shift factor
                        }
                        end = start + 9;   // Setup the end

                        if (end > PageCount)
                        {
                            end = PageCount;     // But only if page number is lower
                        }
                        if (PageCount >= 10 && (end - start) != 9)
                        {
                            start = end - 9;
                        }

                        // Build the output
                        if (!this.PreviousNextGroupDisabled)
                        {
                            System.Web.UI.WebControls.LinkButton prevPage = new System.Web.UI.WebControls.LinkButton();
                            if (CurrentGroup == 1)
                            {
                                prevPage.Enabled = false;
                            }
                            prevPage.CausesValidation = CausesValidation;
                            prevPage.Text             = "&lt;";
                            prevPage.Click           += new EventHandler(OnPreviousGroup_Click);
                            cell.Controls.Add(prevPage);
                        }

                        if (this.RecordCount != 0)
                        {
                            cell.Controls.Add(new LiteralControl(PageGroupLeftSeparator));
                        }

                        for (index = start; index <= end; index++)
                        {
                            if (index != CurrentPage)
                            {
                                System.Web.UI.WebControls.LinkButton gotoPage = new System.Web.UI.WebControls.LinkButton();
                                gotoPage.CausesValidation = CausesValidation;
                                gotoPage.Click           += new EventHandler(OnGotoPage_Click);
                                gotoPage.Text             = index.ToString();
                                cell.Controls.Add(gotoPage);
                            }
                            else
                            {
                                cell.Controls.Add(new LiteralControl("<b>" + index.ToString() + "</b>"));
                            }

                            if (index != end)
                            {
                                cell.Controls.Add(new LiteralControl("&nbsp;"));
                            }
                        }

                        if (this.RecordCount != 0)
                        {
                            cell.Controls.Add(new LiteralControl(PageGroupRightSeparator));
                        }

                        if (!this.PreviousNextGroupDisabled)
                        {
                            System.Web.UI.WebControls.LinkButton nextPage = new System.Web.UI.WebControls.LinkButton();
                            if (this.RecordCount == 0 || (CurrentGroup == (PageCount + 9) / 10))
                            {
                                nextPage.Enabled = false;
                            }
                            nextPage.CausesValidation = CausesValidation;
                            nextPage.Text             = "&gt;";
                            nextPage.Click           += new EventHandler(OnNextGroup_Click);
                            cell.Controls.Add(nextPage);
                        }
                    }
                    break;

                case "": break;

                default:
                    LiteralControl control = new LiteralControl();
                    control.Text = templateItem;
                    cell.Controls.Add(control);
                    break;
                }
            }
        }