Click here to Skip to main content
15,887,214 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: How i display a flash object in asp.net page Pin
Abhijit Jana31-Jul-09 19:28
professionalAbhijit Jana31-Jul-09 19:28 
QuestionEach Row of Datagrid Contains two rows?? Pin
Jagz W31-Jul-09 18:45
professionalJagz W31-Jul-09 18:45 
AnswerRe: Each Row of Datagrid Contains two rows?? Pin
N a v a n e e t h31-Jul-09 19:12
N a v a n e e t h31-Jul-09 19:12 
GeneralRe: Each Row of Datagrid Contains two rows?? Pin
Jagz W1-Aug-09 6:59
professionalJagz W1-Aug-09 6:59 
QuestionTrack refer code to an order in my site Pin
machocr31-Jul-09 18:28
machocr31-Jul-09 18:28 
AnswerRe: Track refer code to an order in my site Pin
N a v a n e e t h31-Jul-09 19:11
N a v a n e e t h31-Jul-09 19:11 
GeneralRe: Track refer code to an order in my site Pin
machocr1-Aug-09 4:28
machocr1-Aug-09 4:28 
QuestionYDreams ImageMapDemo 2.0 Code Behind Issue [modified] Pin
dmgroup198431-Jul-09 11:38
dmgroup198431-Jul-09 11:38 
Hello

I have an ImageMap created using YDreams ImageMapDemo 2.0. I'm using this control for the rollover image effect with circle and polygons hotspots. My issue is I can't seem to figure out how to write the correct C# code for each hotspot. I am able to get one hotspot to have the rollover effect but not the other 4. Can someone please help me out with the code behind. I am very very new with C#. Anyone's help would be much appreciated. Been banging my head for 2 months.

Thanks in advanced

Dale

Form code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<%@ Register Assembly="YDreams.Web.UI.WebControls" Namespace="YDreams.Web.UI.WebControls"
    TagPrefix="ydreams" %>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
    
      function pageLoad() {
      }
    
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
    </div>
    <div>
        <ydreams:ImageMap ID="ImageMap1" ImageUrl="methodology_circle_green.gif" OnClick="ImageMap1_Click" runat="server">
            <ydreams:CircleHotSpot CenterX="210" CenterY="45" Description="Click to test post back..."
                HotSpotMode="Navigate" Radius="41" ToolTip="Post back" Id="AssessCircle" />
            <ydreams:CircleHotSpot CenterX="310" CenterY="120" Description="Click to test post back..."
                HotSpotMode="Navigate" Radius="41" ToolTip="Post back" Id="AnalyzeCircle" />
            <ydreams:CircleHotSpot CenterX="270" CenterY="240" Description="Click to test post back..."
                HotSpotMode="Navigate" Radius="41" ToolTip="Post back" Id="ArchitectCircle" />
            <ydreams:CircleHotSpot CenterX="145" CenterY="240" Description="Click to test post back..."
                HotSpotMode="Navigate" Radius="41" ToolTip="Post back" Id="AssembleCircle" />
            <ydreams:CircleHotSpot CenterX="103" CenterY="120" Description="Click to test post back..."
                HotSpotMode="Navigate" Radius="41" ToolTip="Post back" Id="AssimilateCircle" />
        </ydreams:ImageMap>
        <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
    </div>
    </form>
</body>
</html>

C# Code Behind
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        YDreams.Web.UI.WebControls.HotSpot AssessCircle = new YDreams.Web.UI.WebControls.CircleHotSpot(210, 45, 41);
        {
            ImageMap1.HotSpots.Add(AssessCircle);
            {
                // add OnMouseOver and OnMouseOut event handlers to the blue polygon hot spot
                YDreams.Web.UI.WebControls.CircleHotSpot circleHotSpot = (YDreams.Web.UI.WebControls.CircleHotSpot)this.ImageMap1.HotSpots["AssessCircle"];
                
                {
                    circleHotSpot.Attributes.Add("onMouseOver", "javascript:DisplayImage(image2);");
                    circleHotSpot.Attributes.Add("onMouseOut", "javascript:DisplayImage(image1);");
                }

                // add the script called by the event handlers
                string script = @"
                    var image1 = new Image(413, 285);
                    image1.src = 'methodology_circle_green.gif';
                    var image2 = new Image(413, 285);
                    image2.src = 'methodology_circle_blue_assess.gif';

                    function DisplayImage(image) {
	                    var theImage = document.images['ImageMap1'];
	                    if (!theImage) {
	                        theImage = document.getElementById('ImageMap1');	
	                    }
                        theImage.src = image.src;
                        return true;
                    }
                ";

                this.ClientScript.RegisterClientScriptBlock(this.GetType(), "DisplayImage", script, true);
            }
        }
        
        YDreams.Web.UI.WebControls.HotSpot AnalyzeCircle = new YDreams.Web.UI.WebControls.CircleHotSpot(310, 120, 41);
        {
            ImageMap1.HotSpots.Add(AnalyzeCircle);
            {
                // add OnMouseOver and OnMouseOut event handlers to the blue polygon hot spot
                YDreams.Web.UI.WebControls.CircleHotSpot circleHotSpot = (YDreams.Web.UI.WebControls.CircleHotSpot)this.ImageMap1.HotSpots["AnalyzeCircle"];
                
                {
                    circleHotSpot.Attributes.Add("onMouseOver", "javascript:DisplayImage(image2);");
                    circleHotSpot.Attributes.Add("onMouseOut", "javascript:DisplayImage(image1);");
                }

                // add the script called by the event handlers
                string script = @"
                    var image1 = new Image(413, 285);
                    image1.src = 'methodology_circle_green.gif';
                    var image2 = new Image(413, 285);
                    image2.src = 'methodology_circle_blue_analyze.gif';

                    function DisplayImage(image) {
	                    var theImage = document.images['ImageMap1'];
	                    if (!theImage) {
	                        theImage = document.getElementById('ImageMap1');	
	                    }
                        theImage.src = image.src;
                        return true;
                    }
                ";

                this.ClientScript.RegisterClientScriptBlock(this.GetType(), "DisplayImage", script, true);
            }
        }
    }
    protected void ImageMap1_Click(object sender, YDreams.Web.UI.WebControls.ImageMapClickEventArgs args)
    {
        YDreams.Web.UI.WebControls.HotSpot hotSpot = args.HotSpot;
        int x = args.X;
        int y = args.Y;

        // set the text of the label
        this.Label1.Text = string.Format("Clicked on hot spot \"{0}\" at image coordinates ({1}, {2})", hotSpot.Id, x, y);
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        this.Label1.Text = string.Empty;
    }

}


modified on Friday, July 31, 2009 8:20 PM

AnswerRe: YDreams ImageMapDemo 2.0 Code Behind Issue Pin
Christian Graus31-Jul-09 12:11
protectorChristian Graus31-Jul-09 12:11 
GeneralRe: YDreams ImageMapDemo 2.0 Code Behind Issue Pin
dmgroup198431-Jul-09 18:33
dmgroup198431-Jul-09 18:33 
GeneralRe: YDreams ImageMapDemo 2.0 Code Behind Issue Pin
Christian Graus31-Jul-09 20:55
protectorChristian Graus31-Jul-09 20:55 
Questionweb services .net 2.0 + php Pin
raquidd2231-Jul-09 10:10
raquidd2231-Jul-09 10:10 
AnswerRe: web services .net 2.0 + php Pin
Christian Graus31-Jul-09 10:13
protectorChristian Graus31-Jul-09 10:13 
GeneralRe: web services .net 2.0 + php Pin
raquidd222-Aug-09 10:32
raquidd222-Aug-09 10:32 
QuestionConfused of dynamically added controls on AJAX page Pin
Spoks_ST31-Jul-09 6:42
Spoks_ST31-Jul-09 6:42 
AnswerRe: Confused of dynamically added controls on AJAX page Pin
Abhijit Jana31-Jul-09 7:47
professionalAbhijit Jana31-Jul-09 7:47 
GeneralRe: Confused of dynamically added controls on AJAX page [modified] Pin
Spoks_ST31-Jul-09 9:09
Spoks_ST31-Jul-09 9:09 
QuestionChange Windows Submit button to asp:ImageButton Pin
cmfuchs31-Jul-09 4:15
cmfuchs31-Jul-09 4:15 
AnswerRe: Change Windows Submit button to asp:ImageButton Pin
DoctorMick31-Jul-09 4:36
DoctorMick31-Jul-09 4:36 
QuestionHow to get value of HTML Editor in javascript Pin
Milind R Chavan31-Jul-09 3:45
Milind R Chavan31-Jul-09 3:45 
QuestionChinese Language input in .net Pin
Member 437757331-Jul-09 3:22
Member 437757331-Jul-09 3:22 
QuestionDynamic Menu Pin
blainzaw31-Jul-09 3:13
blainzaw31-Jul-09 3:13 
AnswerRe: Dynamic Menu Pin
Blue_Boy31-Jul-09 3:44
Blue_Boy31-Jul-09 3:44 
AnswerRe: Dynamic Menu Pin
r a m e s h31-Jul-09 5:46
r a m e s h31-Jul-09 5:46 
QuestionLong time to get DataSet While Stored Procedure takes 1 second. Pin
Member 263487631-Jul-09 3:00
Member 263487631-Jul-09 3:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.