Loading...

ImageMap


ImageMap Class Post Back Example

Click on the computer, the phone, or the cup of coffee:

Workplace Computer Phone Cup of coffee

@inherits ControlComponent
<p>Click on the computer, the phone, or the cup of coffee:</p>

<asp.ImageMap @ref="this.workMap" ImageUrl="img/workplace.jpg" ImageAlign="ImageAlign.Left"
                                            Width="400px" Height="379px"
                                            AlternateText="Workplace"
                                            HotSpotMode="HotSpotMode.PostBack"
                                            OnClick="this.WorkMap_Clicked">
                                            <asp.RectangleHotSpot Top="44"
                                            Left="34"
                                            Bottom="350"
                                            Right="270"
                                            PostBackValue="Computer"
                                            AlternateText="Computer">
                                            </asp.RectangleHotSpot>
                                            <asp.RectangleHotSpot Top="172"
                                            Left="290"
                                            Bottom="250"
                                            Right="333"
                                            PostBackValue="Phone"
                                            AlternateText="Phone">
                                            </asp.RectangleHotSpot>
                                            <asp.CircleHotSpot X="337"
                                            Y="300"
                                            Radius="44"
                                            PostBackValue="Cup of coffee"
                                            AlternateText="Cup of coffee">
                                            </asp.CircleHotSpot>
</asp.ImageMap>

<br />
<br />

<asp.Label @ref="this.message" />

@code {
                                            private ImageMap workMap;
                                            private Label message;

                                            protected void WorkMap_Clicked(object sender, ImageMapEventArgs e)
    {
                                            string coordinates;
                                            // When a user clicks the "Computer" hot spot,
                                            // display the hot spot's value.
                                            if (e.PostBackValue.Contains("Computer"))
        {
            coordinates = workMap.HotSpots[0].GetCoordinates();
            message.Text = "You selected the " + e.PostBackValue + "<br />" +
                                            "The coordinates are " + coordinates + ".";
        }
                                            // When a user clicks the "Phone" hot spot,
                                            // display the hot spot's value.
                                            else if (e.PostBackValue.Contains("Phone"))
        {
            coordinates = workMap.HotSpots[1].GetCoordinates();
            message.Text = "You selected the " + e.PostBackValue + "<br />" +
                                            "The coordinates are " + coordinates + ".";
        }
                                            // When a user clicks the "Cup of coffee" hot spot,
                                            // display the hot spot's value.
                                            else if (e.PostBackValue.Contains("Cup of coffee"))
        {
            coordinates = workMap.HotSpots[2].GetCoordinates();
            message.Text = "You selected the " + e.PostBackValue + "<br />" +
                                            "The coordinates are " + coordinates + ".";
        }
                                            else
        {
            message.Text = "You did not click a valid hot spot region.";
        }
    }
}

ImageMap Metadata
Name Type Kind
AccessKey String Parameter
AlternateText String Parameter
Attributes IReadOnlyDictionary Parameter
BackColor String Parameter
BorderColor String Parameter
BorderStyle BorderStyle Parameter
BorderWidth String Parameter
ClientIDMode ClientIDMode Parameter
CssClass String Parameter
DescriptionUrl String Parameter
Enabled Boolean Parameter
ForeColor String Parameter
GenerateEmptyAlternateText Boolean Parameter
Height String Parameter
HotSpotMode HotSpotMode Parameter
ID String Parameter
ImageAlign ImageAlign Parameter
ImageUrl String Parameter
Style String Parameter
TabIndex Int16 Parameter
Target String Parameter
ToolTip String Parameter
Visible Boolean Parameter
Width String Parameter
OnClick ImageMapEventHandler Event
OnDataBinding EventHandler Event
OnDisposed EventHandler Event
OnInit EventHandler Event
OnLoad EventHandler Event
OnPreRender EventHandler Event
OnUnload EventHandler Event
AccessKey String Parameter
AlternateText String Parameter
HotSpotMode HotSpotMode Parameter
NavigateUrl String Parameter
PostBackValue String Parameter
Radius Int32 Parameter
TabIndex Int16 Parameter
Target String Parameter
X Int32 Parameter
Y Int32 Parameter
AccessKey String Parameter
AlternateText String Parameter
Coordinates Int32 Parameter
HotSpotMode HotSpotMode Parameter
NavigateUrl String Parameter
PostBackValue String Parameter
TabIndex Int16 Parameter
Target String Parameter
AccessKey String Parameter
AlternateText String Parameter
Bottom Int32 Parameter
HotSpotMode HotSpotMode Parameter
Left Int32 Parameter
NavigateUrl String Parameter
PostBackValue String Parameter
Right Int32 Parameter
TabIndex Int16 Parameter
Target String Parameter
Top Int32 Parameter
Copyright © 2024 Jurio li All rights reserved.
An unhandled error has occurred. Reload 🗙