protected virtual void RaisePostBackEvent(string eventArgument) { base.ValidateEvent(this.UniqueID, eventArgument); string postBackValue = null; if ((eventArgument != null) && (this._hotSpots != null)) { int num = int.Parse(eventArgument, CultureInfo.InvariantCulture); if ((num >= 0) && (num < this._hotSpots.Count)) { HotSpot spot = this._hotSpots[num]; System.Web.UI.WebControls.HotSpotMode hotSpotMode = spot.HotSpotMode; switch (hotSpotMode) { case System.Web.UI.WebControls.HotSpotMode.NotSet: hotSpotMode = this.HotSpotMode; break; case System.Web.UI.WebControls.HotSpotMode.PostBack: postBackValue = spot.PostBackValue; break; } } } if (postBackValue != null) { this.OnClick(new ImageMapEventArgs(postBackValue)); } }
protected internal override void Render(HtmlTextWriter writer) { if ((this.Enabled && !base.IsEnabled) && this.SupportsDisabledAttribute) { writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled"); } this._hasHotSpots = (this._hotSpots != null) && (this._hotSpots.Count > 0); base.Render(writer); if (this._hasHotSpots) { string str = "ImageMap" + this.ClientID; writer.AddAttribute(HtmlTextWriterAttribute.Name, str); writer.AddAttribute(HtmlTextWriterAttribute.Id, str); writer.RenderBeginTag(HtmlTextWriterTag.Map); System.Web.UI.WebControls.HotSpotMode hotSpotMode = this.HotSpotMode; if (hotSpotMode == System.Web.UI.WebControls.HotSpotMode.NotSet) { hotSpotMode = System.Web.UI.WebControls.HotSpotMode.Navigate; } int num = 0; string target = this.Target; foreach (HotSpot spot in this._hotSpots) { writer.AddAttribute(HtmlTextWriterAttribute.Shape, spot.MarkupName, false); writer.AddAttribute(HtmlTextWriterAttribute.Coords, spot.GetCoordinates()); System.Web.UI.WebControls.HotSpotMode mode2 = spot.HotSpotMode; switch (mode2) { case System.Web.UI.WebControls.HotSpotMode.NotSet: mode2 = hotSpotMode; break; case System.Web.UI.WebControls.HotSpotMode.PostBack: if (this.Page != null) { this.Page.VerifyRenderingInServerForm(this); } if ((this.RenderingCompatibility < VersionUtil.Framework40) || base.IsEnabled) { string argument = num.ToString(CultureInfo.InvariantCulture); writer.AddAttribute(HtmlTextWriterAttribute.Href, this.Page.ClientScript.GetPostBackClientHyperlink(this, argument, true)); } goto Label_01BB; case System.Web.UI.WebControls.HotSpotMode.Navigate: { if ((this.RenderingCompatibility < VersionUtil.Framework40) || base.IsEnabled) { string str4 = base.ResolveClientUrl(spot.NavigateUrl); writer.AddAttribute(HtmlTextWriterAttribute.Href, str4); } string str5 = spot.Target; if (str5.Length == 0) { str5 = target; } if (str5.Length > 0) { writer.AddAttribute(HtmlTextWriterAttribute.Target, str5); } goto Label_01BB; } } if (mode2 == System.Web.UI.WebControls.HotSpotMode.Inactive) { writer.AddAttribute("nohref", "true"); } Label_01BB: writer.AddAttribute(HtmlTextWriterAttribute.Title, spot.AlternateText); writer.AddAttribute(HtmlTextWriterAttribute.Alt, spot.AlternateText); string accessKey = spot.AccessKey; if (accessKey.Length > 0) { writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, accessKey); } int tabIndex = spot.TabIndex; if (tabIndex != 0) { writer.AddAttribute(HtmlTextWriterAttribute.Tabindex, tabIndex.ToString(NumberFormatInfo.InvariantInfo)); } writer.RenderBeginTag(HtmlTextWriterTag.Area); writer.RenderEndTag(); num++; } writer.RenderEndTag(); } }