ImageMap asp.net control click event

W

William Main

I have the following code

ImageMap image1 = new ImageMap();
image1.Click += new ImageMapEventHandler(ImageMap_Click);
image1.HotSpotMode = HotSpotMode.PostBack;
image1.ImageUrl = "~/images/permacon/page2.png";
if (Percentage != 100.0)
{
image1.Width = Unit.Percentage(Percentage);
image1.Height = Unit.Percentage(Percentage);
}
image1.HotSpots.Add(hs(7,72, 115, 195, 196));
image1.HotSpots.Add(hs(17, 197, 114, 317, 196));
image1.HotSpots.Add(hs(25, 75, 239, 194, 324));
image1.HotSpots.Add(hs(33, 198, 240, 312, 323));
image1.HotSpots.Add(hs(34, 74, 368, 191, 448));
image1.HotSpots.Add(hs(35, 196, 369, 317, 446));
image1.HotSpots.Add(hs(37, 155, 487, 202, 498));
image1.HotSpots.Add(hs(38, 184, 500, 249, 512));
image1.HotSpots.Add(hs(39, 97, 515, 316, 524));
image1.HotSpots.Add(hs(40, 142, 528, 274, 537));
image1.HotSpots.Add(hs(41, 183, 541, 272, 550));
image1.HotSpots.Add(hs(42, 156, 553, 256, 564));
image1.HotSpots.Add(hs(43, 150, 566, 249, 579));
image1.HotSpots.Add(hs(44, 149, 581, 205, 592));
image1.HotSpots.Add(hs(45, 186, 594, 245, 605));
image1.HotSpots.Add(hs(46, 186, 608, 266, 619));
image1.HotSpots.Add(hs(49, 153, 654, 255, 663));
image1.HotSpots.Add(hs(50, 130, 665, 270, 677));
image1.HotSpots.Add(hs(51, 134, 679, 246, 690));
image1.HotSpots.Add(hs(52, 186, 694, 251, 704));
image1.HotSpots.Add(hs(53, 128, 706, 280, 717));
image1.HotSpots.Add(hs(54, 140, 719, 299, 760));
image1.HotSpots.Add(hs(55, 148, 792, 242, 800));
image1.HotSpots.Add(hs(56, 140, 805, 270, 828));
image1.HotSpots.Add(hs(57, 184, 863, 238, 873));
image1.HotSpots.Add(hs(58, 140, 878, 203, 888));
image1.HotSpots.Add(hs(59, 138, 888, 293, 901));
image1.HotSpots.Add(hs(60, 184, 916, 286, 928));
image1.HotSpots.Add(hs(63, 185, 929, 258, 939));
image1.HotSpots.Add(hs(64, 184, 942, 271, 956));
this.pnlPages.Controls.Add(image1);

the method hs is

RectangleHotSpot hs(int Page, int Left, int Top, int Right, int Bottom)
{
RectangleHotSpot hotspot = new RectangleHotSpot();
hotspot.HotSpotMode = HotSpotMode.PostBack;
hotspot.PostBackValue = Page.ToString();
hotspot.Bottom = (int)((double)Bottom * (Percentage / 100.0));
hotspot.Left = (int)((double)Left * (Percentage / 100.0));
hotspot.Right = (int)((double)Right * (Percentage / 100.0));
hotspot.Top = (int)((double)Top * (Percentage / 100.0));
return hotspot;
}

and the ImageMap_Click is

void ImageMap_Click(object sender, ImageMapEventArgs e)
{

CurrentPage = Convert.ToInt32(e.PostBackValue);
ShowPage();
}

When I render this page and click on any of the hotspots, the ImageMap_Click
event is never fired.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top