Ejemplo n.º 1
0
        protected override void Render(HtmlTextWriter output)
        {
            if (!string.IsNullOrEmpty(Value))
            {
                var array = Value.Split(',');
                if (array.Length > 0)
                {
                    int.TryParse(array[0], out _mapZoomFactor);
                }

                if (array.Length > 1)
                {
                    _mapType = array[1];
                }
            }

            ParseParameters(Source);
            if (!string.IsNullOrEmpty(AddressFieldName))
            {
                base.Render(output);

                var db = Factory.GetDatabase("master") ?? Factory.GetDatabase("web");

                var id = !string.IsNullOrEmpty(ItemID)
                    ? ItemID
                    : ControlAttributes.Substring(ControlAttributes.IndexOf("//master/", StringComparison.Ordinal) + 9,
                                                  38);
                var item = new ID(id).ToSitecoreItem(db);

                //render other control

                var centre = "";

                //get lat lng

                var location = GetGeoData(item, ref centre);


                _mapImageCtrl = new Image
                {
                    ID       = ID + "_Img_MapView",
                    CssClass = "imageMapView",
                    Width    = MAP_WIDTH,
                    Height   = MAP_HEIGHT,
                    ImageUrl = GetGoogleMapImageUrl(location, centre, item)
                };
                _mapImageCtrl.Style.Add("padding-top", "5px");

                if (Debug)
                {
                    output.Write(
                        "<div style='background-color:silver;color:white'>{0}</div>",
                        _mapImageCtrl.ImageUrl);
                }

                _mapImageCtrl.RenderControl(output);
            }
        }
Ejemplo n.º 2
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            // Create and render a new Image web control.
            System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();
            image.ID            = "Image1";
            image.ImageUrl      = "image.jpg";
            image.AlternateText = "Image for XML.";
            image.RenderControl(writer);

            // Call the base class's Render method.
            base.Render(writer);
        }
Ejemplo n.º 3
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            // Call the base class's Render method.
            base.Render(writer);

            // Render a BR HTML tag
            writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Br);

            // Create and render a new Image Web control.
            System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();
            image.ID            = "Image1";
            image.ImageUrl      = "image.jpg";
            image.AlternateText = "Image for CheckBox1.";
            image.RenderControl(writer);
        }
Ejemplo n.º 4
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            string navigateUrl   = System.String.Empty;
            string imageUrl      = System.String.Empty;
            string alternateText = System.String.Empty;

            // If the value for the Advertisement File is not empty.
            if (this.AdvertisementFile.Length > 0)
            {
                // Get a random ad.
                GetRandomAd(out imageUrl, out navigateUrl, out alternateText);
            }

            // Create and render a new HyperLink Web control.
            System.Web.UI.WebControls.HyperLink bannerLink = new System.Web.UI.WebControls.HyperLink();
            foreach (string key in this.Attributes.Keys)
            {
                bannerLink.Attributes[key] = this.Attributes[key];
            }
            if (this.ID != null && this.ID.Length > 0)
            {
                bannerLink.ID = this.ClientID;
            }
            bannerLink.NavigateUrl = navigateUrl;
            bannerLink.Target      = this.Target;
            bannerLink.AccessKey   = this.AccessKey;
            bannerLink.Enabled     = this.Enabled;
            bannerLink.TabIndex    = this.TabIndex;
            bannerLink.RenderBeginTag(writer);

            // Create and render a new Image Web control.
            System.Web.UI.WebControls.Image bannerImage = new System.Web.UI.WebControls.Image();
            if (ControlStyleCreated)
            {
                bannerImage.ApplyStyle(this.ControlStyle);
            }
            bannerImage.AlternateText = alternateText;
            bannerImage.ImageUrl      = imageUrl;
            bannerImage.ToolTip       = this.ToolTip;
            bannerImage.RenderControl(writer);
            bannerLink.RenderEndTag(writer);
        }