Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8099975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:35:17+00:00 2026-06-05T22:35:17+00:00

basically my aim is to use JQuery to post back an x & y

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:35:19+00:00Added an answer on June 5, 2026 at 10:35 pm

    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:

    var coords = new Dictionary<int, MouseCoordinates>();
    
    HttpContext.Session.Add("coords", coords);
    
    // Accessing Dictionary From Session
    var coords = (Dictionary<int, MouseCoordinates>)HttpContext.Session["coords"];
    
    // Adding Values using a integer stage that's posted back to the controller
    coords.Add(currentStage, new MouseCoordinates { xposition = xpos, yposition = ypos });
    
    // Looping through the session at the end of the cycle
                foreach (var ords in coords)
                {
                    var qnode = ords.Key;
                    var xvalue = ords.Value.xposition;
                    var yvalue = ords.Value.yposition;
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically what I am doing is giving a user a list of terms via
Basically I have converted a tab delimited txt file into a list containing a
Basically my aim is to have this timer reset whenever the user presses button
Basically my task is to make the counter on a micro controller board count
Basically, I aim to allow my user to specify an ip range for access
Shortened Aim: To pass a variable via $.POST to a PHP file (get.php), and
My aim is to get two numbers and perform an corresponding to the values
I want to create a 2D array which can be used for two different
I got a question to ask on building firefox plugin, basically my aim is
Basically I thought I could use git for deployment as those rails cloud providers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.