basically my aim is to use JQuery to post back an x & y mouse co-ordinate to my controller where the 2 values are added to an array/list which is then added to the session.
I want to iterate through a series of 60 clicks (and subsequently postbacks to the controller) before building an XML string with each co-ordinate in it.
Something along the lines of this:
<xml>
<click1>
<xpos>45</xpos>
<ypos>55</ypos>
</click1>
<click2>
<xpos>45</xpos>
<ypos>55</ypos>
</click2>
</xml>
I’m unsure as to how best to store the individual mouse clicks after each postback, and I thought perhaps a session and a multi-dimensional array/list would be good for this? I’m also a little confused as to how to convert the session back into a list and assemble the XML as required.
Could anyone point me in the right direction?
Many thanks!
Sykth.
I solved this by creating a Dictionary of type , with MouseCoordinates referring to a class which accepted 2 string values for xposition and yposition.
I then placed the Dictionary into a session, re-casting it as a Dict when I needed to add a new value to it.
Finally I looped through the Dictionary at the end of my cycle of clicks retrieving all the values.
I hope this code helps someone: