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">
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">
>
>
>
>
>
> 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/