Exemplo n.º 1
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   before the DropDownList (VSWhidbey 77709)
            writer.Write(" ");

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

            writer.Write(" ");

            RenderVerbs(writer);

            writer.RenderEndTag();  // Div
        }