Is this possible in ASP?

Is this possible in ASP?

am 05.11.2004 19:49:15 von jack

Hi,
I had posted the question yesterday, however I did not get a real answer.

PROBLEM:
I need to work on a project with a state map with associated counties. On
clicking a county, it should give the summary stats of crime for that county
on a box on the page. On double clicking a county a new page with detail
crime report for that county should pop up.
Question 1) My first question is: can asp be applied here to accomplish the
above goal. 2) I cannot figure out as to how to handle the event when one
moves from one county to another that will trigger the changes in the summary
value in the box. 3) Does this need just one map showing the various
counties? Thanks in advance.

Re: Is this possible in ASP?

am 05.11.2004 20:21:26 von reb01501

Jack wrote:
> Hi,
> I had posted the question yesterday, however I did not get a real
> answer.
>
> PROBLEM:
ANSWER:
No, this is not possible in ASP (which is strictly server-side code). You
need an image to react to user-initiated events. This can only be
accomplished via client-side code. Please follow up in a client-side
newsgroup such as .scripting.jscript or one of the groups with "dhtml" in
their names (the latter are pretty low-traffic groups - you'll probably have
better luck in the .scripting group).

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: Is this possible in ASP?

am 05.11.2004 20:25:03 von Chris Hohmann

"Jack" wrote in message
news:FE72FBCC-B6B7-42C2-A4C6-6364F19E4D7A@microsoft.com...
> Hi,
> I had posted the question yesterday, however I did not get a real answer.
>
> PROBLEM:
> I need to work on a project with a state map with associated counties. On
> clicking a county, it should give the summary stats of crime for that
county
> on a box on the page. On double clicking a county a new page with detail
> crime report for that county should pop up.
> Question 1) My first question is: can asp be applied here to accomplish
the
> above goal.
> 2) I cannot figure out as to how to handle the event when one
> moves from one county to another that will trigger the changes in the
summary
> value in the box. 3) Does this need just one map showing the various
> counties? Thanks in advance.

Re: Is this possible in ASP?

am 05.11.2004 20:52:47 von Chris Hohmann

Response inline

"Jack" wrote in message
news:FE72FBCC-B6B7-42C2-A4C6-6364F19E4D7A@microsoft.com...
> Hi,
> I had posted the question yesterday, however I did not get a real answer.
>
> PROBLEM:
> I need to work on a project with a state map with associated counties. On
> clicking a county, it should give the summary stats of crime for that
county
> on a box on the page. On double clicking a county a new page with detail
> crime report for that county should pop up.
> Question 1) My first question is: can asp be applied here to accomplish
the
> above goal.

Yes and no. Yes, you could make a trip back to the server everytime a county
was clicked and re-render the map and include crime data for the county
selected. But as Evertjan suggested in his reply to your original post, this
could and probablly should be handled on the client side. He also provided a
link to a resource that appears to do just that. What you won't be able to
do is respond to a double-click using ASP. ASP has no idea what a
double-click is.

> 2) I cannot figure out as to how to handle the event when one
> moves from one county to another that will trigger the changes in the
summary
> value in the box.

You cannot handle this client-side event using ASP which operates on the
server-side.

> 3) Does this need just one map showing the various
> counties? Thanks in advance.

Yes

Re: Is this possible in ASP?

am 05.11.2004 21:46:36 von rdanjou

See this site:
http://us.cnn.com/ELECTION/2004/pages/results/president/

If you mouseover a state, you'll get summary information.
If you click on a state, you are redirected to a new page with detailed
information.
Take a look at the code. It should get you started in the right direction.

"Jack" wrote in message
news:FE72FBCC-B6B7-42C2-A4C6-6364F19E4D7A@microsoft.com...
> Hi,
> I had posted the question yesterday, however I did not get a real answer.
>
> PROBLEM:
> I need to work on a project with a state map with associated counties. On
> clicking a county, it should give the summary stats of crime for that
county
> on a box on the page. On double clicking a county a new page with detail
> crime report for that county should pop up.
> Question 1) My first question is: can asp be applied here to accomplish
the
> above goal. 2) I cannot figure out as to how to handle the event when one
> moves from one county to another that will trigger the changes in the
summary
> value in the box. 3) Does this need just one map showing the various
> counties? Thanks in advance.

Re: Is this possible in ASP?

am 05.11.2004 23:02:24 von McKirahan

"Jack" wrote in message
news:FE72FBCC-B6B7-42C2-A4C6-6364F19E4D7A@microsoft.com...
> Hi,
> I had posted the question yesterday, however I did not get a real answer.
>
> PROBLEM:
> I need to work on a project with a state map with associated counties. On
> clicking a county, it should give the summary stats of crime for that
county
> on a box on the page. On double clicking a county a new page with detail
> crime report for that county should pop up.
> Question 1) My first question is: can asp be applied here to accomplish
the
> above goal. 2) I cannot figure out as to how to handle the event when one
> moves from one county to another that will trigger the changes in the
summary
> value in the box. 3) Does this need just one map showing the various
> counties? Thanks in advance.

Which state? What kind of stats?

One approach is to have the server-side generate an array of the data you
want and the client-side display the appropriate array entry for the
selected county.

Re: Is this possible in ASP?

am 05.11.2004 23:47:21 von McKirahan

"McKirahan" wrote in message
news:MLSid.359295$MQ5.276268@attbi_s52...
> "Jack" wrote in message
> news:FE72FBCC-B6B7-42C2-A4C6-6364F19E4D7A@microsoft.com...
> > Hi,
> > I had posted the question yesterday, however I did not get a real
answer.
> >
> > PROBLEM:
> > I need to work on a project with a state map with associated counties.
On
> > clicking a county, it should give the summary stats of crime for that
> county
> > on a box on the page. On double clicking a county a new page with detail
> > crime report for that county should pop up.
> > Question 1) My first question is: can asp be applied here to accomplish
> the
> > above goal. 2) I cannot figure out as to how to handle the event when
one
> > moves from one county to another that will trigger the changes in the
> summary
> > value in the box. 3) Does this need just one map showing the various
> > counties? Thanks in advance.
>
> Which state? What kind of stats?
>
> One approach is to have the server-side generate an array of the data you
> want and the client-side display the appropriate array entry for the
> selected county.

Here's an example of my approach using states.

The MS-Access database consists of one table named "states" with two fields:
"Code" and "State"; it contains 51 records: one for each state plus the
District of Columbia.

<% @Language="VBScript" %>
<% Option Explicit
'*
'* Declare Constants
'*
Const cASP = "state.asp"
Const cMDB = "state.mdb"
Const cDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
'*
'* Declare Variables
'*
Dim arrRST(1)
' arrRST(0) = Code
' arrRST(1) = State
Dim intRST
intRST = 0
Dim strRST
Dim strSQL
strSQL = "SELECT * FROM states"
Dim arrSTA(51)
Dim intSTA
intSTA = 0
'*
'* Declare Objects
'*
Dim objADO
Set objADO = Server.CreateObject("ADODB.Connection")
objADO.Open cDSN & Server.MapPath(cMDB)
Dim objRST
Set objRST = objADO.Execute(strSQL)
'*
'* Process Managers
'*
Do While Not objRST.EOF
arrRST(0) = objRST("Code")
arrRST(1) = objRST("State")
strRST = Join(arrRST,"|")
intSTA = intSTA + 1
'Response.Write("
" & intSTA & ". " & strRST)
arrSTA(intSTA) = strRST
objRST.MoveNext
Loop
'*
'* Destroy Objects
'*
Set objRST = Nothing
objADO.Close
Set objADO = Nothing
%>


<%=cASP%>




height="321" alt="Click on a State." usemap="#Map">


coords="172,296,225,319">
coords="199,9,264,30">
coords="7,245,85,313">
coords="338,203,362,201,374,244,350,248,351,257,339,257">
coords="278,189,323,190,310,223,309,230,279,229">
coords="98,170,143,176,133,239,112,238,80,214">
coords="22,92,59,102,49,134,87,192,81,213,61,213,31,183,16,1 10,23,91">
coords="151,131,209,138,208,181,143,174">
coords="456,102,469,99,469,104,458,112">
coords="474,128,490,139">

coords="442,132,451,138,453,146,444,144">
coords="455,147,471,158">
coords="408,246,348,252,350,258,392,270,420,310,439,304">
coords="384,201,361,203,375,252,407,247,411,233">
coords="91,259,167,313">
coords="260,109,298,107,310,121,303,141,266,142,257,119">
coords="101,29,110,31,136,82,132,114,84,105">
coords="310,121,303,141,308,158,325,179,331,179,339,159,336, 126,330,117">
coords="336,126,358,122,362,154,347,168,336,168,338,158">
coords="210,149,270,149,274,159,276,186,208,182">
coords="327,185,331,179,338,170,352,167,367,154,382,159,389, 169,378,179">
coords="281,230,309,230,307,251,322,251,327,260,332,272,284, 268">
coords="454,93,474,87,485,99,477,101,472,97,454,99">
coords="480,106,498,117">
coords="410,138,441,132,440,136,442,144,449,152,445,156,436, 148">
coords="457,158,476,169">
coords="465,58,468,52,470,34,483,31,495,56,473,84">
coords="308,70,337,82,342,120,377,119,369,66">
coords="253,46,260,109,299,106,288,90,290,68,309,55,269,44">
coords="267,141,303,141,316,167,327,179,324,189,275,187,274, 158">
coords="319,205,336,206,339,256,326,258,323,252,306,249,313, 238,308,228">
coords="110,31,201,43,196,89,142,81,127,85,116,68">
coords="372,199,394,180,452,171,431,204,403,192">
coords="201,44,199,76,256,80,252,46">
coords="195,111,257,119,267,148,211,146,210,136,193,134">
coords="446,29,461,40">
coords="462,64,465,61,473,86,458,91">
coords="445,112,454,117,457,126,450,140,443,131,445,124">
coords="458,136,473,148">
coords="147,176,197,183,191,239,159,235,134,240">
coords="59,101,107,111,91,195,50,133">
coords="400,113,435,71,448,71,457,116,439,108">
coords="361,124,395,116,399,139,384,159,366,151">
coords="201,184,278,187,279,223,230,213,227,190,199,188">
coords="24,93,86,107,95,63,37,46">
coords="394,115,397,140,443,131,444,113,436,107">
coords="469,97,474,97,479,102,471,106">
coords="479,117,493,128">
coords="384,204,413,232,431,205,416,195,396,193">
coords="200,77,257,80,257,117,241,112,196,109">
coords="327,186,318,202,338,204,369,199,392,178">
coords="197,187,224,189,227,212,278,223,283,268,247,310,191, 272,160,235,193,
240">
coords="109,114,131,117,130,126,149,131,141,176,97,168">
coords="381,181,389,170,404,170,421,142,441,155,446,171">
coords="433,40,450,53">
coords="447,69,461,66,460,77,457,91,454,92">
coords="44,13,42,45,94,64,99,29">
coords="293,72,292,97,310,119,333,116,335,85,305,69">
coords="383,159,398,142,420,139,403,166,390,171">
coords="139,83,194,89,192,136,132,127">




The image map is borrowed for testing; thanks to
http://www.waypoint.org/usmap1.gif.

Re: Is this possible in ASP?

am 06.11.2004 00:00:44 von McKirahan

"McKirahan" wrote in message
news:ZpTid.60676$R05.37443@attbi_s53...


[snip]

I just noticed that the state codes for Kansas ('ks'), Jentucky ('ky'), and
Viriginia ('va') are wrong in the previous image map.

Re: Is this possible in ASP?

am 06.11.2004 00:02:02 von jack

Thanks to everybody for all the help extended here, specially to McKirahan who
was generous enough to post code for demonstration with clarity. I
appreciate all the help. Thanks again.

"McKirahan" wrote:

> "McKirahan" wrote in message
> news:MLSid.359295$MQ5.276268@attbi_s52...
> > "Jack" wrote in message
> > news:FE72FBCC-B6B7-42C2-A4C6-6364F19E4D7A@microsoft.com...
> > > Hi,
> > > I had posted the question yesterday, however I did not get a real
> answer.
> > >
> > > PROBLEM:
> > > I need to work on a project with a state map with associated counties.
> On
> > > clicking a county, it should give the summary stats of crime for that
> > county
> > > on a box on the page. On double clicking a county a new page with detail
> > > crime report for that county should pop up.
> > > Question 1) My first question is: can asp be applied here to accomplish
> > the
> > > above goal. 2) I cannot figure out as to how to handle the event when
> one
> > > moves from one county to another that will trigger the changes in the
> > summary
> > > value in the box. 3) Does this need just one map showing the various
> > > counties? Thanks in advance.
> >
> > Which state? What kind of stats?
> >
> > One approach is to have the server-side generate an array of the data you
> > want and the client-side display the appropriate array entry for the
> > selected county.
>
> Here's an example of my approach using states.
>
> The MS-Access database consists of one table named "states" with two fields:
> "Code" and "State"; it contains 51 records: one for each state plus the
> District of Columbia.
>
> <% @Language="VBScript" %>
> <% Option Explicit
> '*
> '* Declare Constants
> '*
> Const cASP = "state.asp"
> Const cMDB = "state.mdb"
> Const cDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
> '*
> '* Declare Variables
> '*
> Dim arrRST(1)
> ' arrRST(0) = Code
> ' arrRST(1) = State
> Dim intRST
> intRST = 0
> Dim strRST
> Dim strSQL
> strSQL = "SELECT * FROM states"
> Dim arrSTA(51)
> Dim intSTA
> intSTA = 0
> '*
> '* Declare Objects
> '*
> Dim objADO
> Set objADO = Server.CreateObject("ADODB.Connection")
> objADO.Open cDSN & Server.MapPath(cMDB)
> Dim objRST
> Set objRST = objADO.Execute(strSQL)
> '*
> '* Process Managers
> '*
> Do While Not objRST.EOF
> arrRST(0) = objRST("Code")
> arrRST(1) = objRST("State")
> strRST = Join(arrRST,"|")
> intSTA = intSTA + 1
> 'Response.Write("
" & intSTA & ". " & strRST)
> arrSTA(intSTA) = strRST
> objRST.MoveNext
> Loop
> '*
> '* Destroy Objects
> '*
> Set objRST = Nothing
> objADO.Close
> Set objADO = Nothing
> %>
>
>
> <%=cASP%>
>
>
>
>


> > height="321" alt="Click on a State." usemap="#Map">
>

>
> > coords="172,296,225,319">
> > coords="199,9,264,30">
> > coords="7,245,85,313">
> > coords="338,203,362,201,374,244,350,248,351,257,339,257">
> > coords="278,189,323,190,310,223,309,230,279,229">
> > coords="98,170,143,176,133,239,112,238,80,214">
> > coords="22,92,59,102,49,134,87,192,81,213,61,213,31,183,16,1 10,23,91">
> > coords="151,131,209,138,208,181,143,174">
> > coords="456,102,469,99,469,104,458,112">
> > coords="474,128,490,139">
>
> > coords="442,132,451,138,453,146,444,144">
> > coords="455,147,471,158">
> > coords="408,246,348,252,350,258,392,270,420,310,439,304">
> > coords="384,201,361,203,375,252,407,247,411,233">
> > coords="91,259,167,313">
> > coords="260,109,298,107,310,121,303,141,266,142,257,119">
> > coords="101,29,110,31,136,82,132,114,84,105">
> > coords="310,121,303,141,308,158,325,179,331,179,339,159,336, 126,330,117">
> > coords="336,126,358,122,362,154,347,168,336,168,338,158">
> > coords="210,149,270,149,274,159,276,186,208,182">
> > coords="327,185,331,179,338,170,352,167,367,154,382,159,389, 169,378,179">
> > coords="281,230,309,230,307,251,322,251,327,260,332,272,284, 268">
> > coords="454,93,474,87,485,99,477,101,472,97,454,99">
> > coords="480,106,498,117">
> > coords="410,138,441,132,440,136,442,144,449,152,445,156,436, 148">
> > coords="457,158,476,169">
> > coords="465,58,468,52,470,34,483,31,495,56,473,84">
> > coords="308,70,337,82,342,120,377,119,369,66">
> > coords="253,46,260,109,299,106,288,90,290,68,309,55,269,44">
> > coords="267,141,303,141,316,167,327,179,324,189,275,187,274, 158">
> > coords="319,205,336,206,339,256,326,258,323,252,306,249,313, 238,308,228">
> > coords="110,31,201,43,196,89,142,81,127,85,116,68">
> > coords="372,199,394,180,452,171,431,204,403,192">
> > coords="201,44,199,76,256,80,252,46">
> > coords="195,111,257,119,267,148,211,146,210,136,193,134">
> > coords="446,29,461,40">
> > coords="462,64,465,61,473,86,458,91">
> > coords="445,112,454,117,457,126,450,140,443,131,445,124">
> > coords="458,136,473,148">
> > coords="147,176,197,183,191,239,159,235,134,240">
> > coords="59,101,107,111,91,195,50,133">
> > coords="400,113,435,71,448,71,457,116,439,108">
> > coords="361,124,395,116,399,139,384,159,366,151">
> > coords="201,184,278,187,279,223,230,213,227,190,199,188">
> > coords="24,93,86,107,95,63,37,46">
> > coords="394,115,397,140,443,131,444,113,436,107">
> > coords="469,97,474,97,479,102,471,106">
> > coords="479,117,493,128">
> > coords="384,204,413,232,431,205,416,195,396,193">
> > coords="200,77,257,80,257,117,241,112,196,109">
> > coords="327,186,318,202,338,204,369,199,392,178">
> > coords="197,187,224,189,227,212,278,223,283,268,247,310,191, 272,160,235,193,
> 240">
> > coords="109,114,131,117,130,126,149,131,141,176,97,168">
> > coords="381,181,389,170,404,170,421,142,441,155,446,171">
> > coords="433,40,450,53">
> > coords="447,69,461,66,460,77,457,91,454,92">
> > coords="44,13,42,45,94,64,99,29">
> > coords="293,72,292,97,310,119,333,116,335,85,305,69">
> > coords="383,159,398,142,420,139,403,166,390,171">
> > coords="139,83,194,89,192,136,132,127">

>
>
>
> The image map is borrowed for testing; thanks to
> http://www.waypoint.org/usmap1.gif.
>
>
>

Re: Is this possible in ASP?

am 08.11.2004 17:39:16 von jack

I got one questioin here. How do you come up with the values of coordiantes
for all the shapes of different shapes? Thanks

"McKirahan" wrote:

> "McKirahan" wrote in message
> news:ZpTid.60676$R05.37443@attbi_s53...
>
> > > >
> [snip]
>
> I just noticed that the state codes for Kansas ('ks'), Jentucky ('ky'), and
> Viriginia ('va') are wrong in the previous image map.
>
>
>

Re: Is this possible in ASP?

am 08.11.2004 22:39:43 von McKirahan

"Jack" wrote in message
news:8DED66F0-45E9-4D70-ABF6-94B2DD68EE36@microsoft.com...
> I got one questioin here. How do you come up with the values of
coordiantes
> for all the shapes of different shapes? Thanks

[snip]

So You Want A Client-Side Image Map, Huh?
http://www.htmlgoodies.com/tutors/cs_imap.html

Mapedit is an imagemap-editing program.
http://www.boutell.com/mapedit/