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 8796421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:37:11+00:00 2026-06-13T23:37:11+00:00

i’m having a problem where I am trying to save the geolocation of an

  • 0

i’m having a problem where I am trying to save the geolocation of an address unto a file. I am using hidden labels to transfer the information.

on the client side button event I have:

   function save() {
        document.getElementById("hidLat").value = y;
        document.getElementById("hidLon").value = x;
        <% saveAddress s = save(); %>
   }

and in c# I have:

   protected saveAddress save()
   {
        saveAddress s = new saveAddress();
        s.latitude = hidLat.Value;
        s.longitude = hidLon.Value;

        using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\\savedAddresses.txt", true))
        {
            file.WriteLine(s.latitude + " " + s.longitude);
            file.Close();
        }  

        return s;
   }

When I click on the button the file is created but nothing is saved into it.
Am I doing this right or is there a better way to try and write the user input into a file?

  • 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-13T23:37:12+00:00Added an answer on June 13, 2026 at 11:37 pm

    I think you’re getting confused on the web lifecycle. In your particular instance, this is what is happening:

    1. Your page is requested, and the ASP.NET Runtime loads your code behind and attempts to execute the page.
    2. In the process of executing your page, the ASPX contains code to call

       saveAddress s = save()
      

      In this way, that method is called before the page is even rendered back to the client.

    3. When the page is finally sent down to the client, you have some client side code invoking function save().

    Im guessing you want that server side method to be invoked after the javascript function has run. You have two options:

    1. Full PostBack – You post the form back to the server, and your ASPX code behind can have some code there to inspect Page.IsPostBack and attempt to call your server side method.
    2. Ajax – You can make an ajax request to a specific handler on your site and then invoke your server side save method.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I am trying to understand how to use SyndicationItem to display feed which is

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.