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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:42:08+00:00 2026-05-23T20:42:08+00:00

I am trying to send my model back to the controller with 2 values

  • 0

I am trying to send my model back to the controller with 2 values retrieved from a map control. I figured the best solution would be to put these values in a hidden input ‘Html.hiddenfor()’ so the controller receives the values in the model.

This is my JavaScript

endDragDetails = function (e) {
    alert("Event Info - start drag \n" + "Start Latitude/Longitude: " + e.entity.getLocation());
    var locationx = e.entity.getLocation();
    alert(locationx.latitude);
    document.getElementById("longitude").value = parseFloat(locationx.longitude);
}

The alertboxes show me there is a floating point value in the locationx var. I’ve tried passing it with the parseFloat() function In case the floating point number is actually a string. The id of longitude is indeed “longitude”, I checked that in the html source.

this is my cshtml part

@Html.HiddenFor(m => m.longitude);

All I’m getting back is a 0,0.
Am I missing something in this solution?

UPDATE If I change the hiddenfor with @Html.TextBoxFor(m => m.longitude) it displays the longitude in my textbox after executing the javascript method. However it does not send it to the controller, the value remains 0,0. It does however send all my other values like for example first name string, … to the controller.

  • 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-05-23T20:42:09+00:00Added an answer on May 23, 2026 at 8:42 pm

    I’ve just done a quick check with what you’re doing and it all seems ok. However, I’m a bit dubious of the value which you are getting from the locationx.longitude as you can’t parse 0,0 or similar as a float. And you shouldn’t need to when assigning to the hidden field as it handles it as a string anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to send a model to ASP.NET MVC controller action, but for
I am trying to send an email from a site I am building, but
I am trying to send some data from a LINQ query in C# to
I am trying to send an email to multiple users. I have a model
I'm trying to send a number of virtual attributes from my form but keep
I'm trying to use Rails(2)'s to_json model serializing mechanism to emit some data from
Trying to send some email in my C# app. I am behind a proxy
im trying to send rest api Users.getLoggedInUser i have all the secret session and
I'm trying to send an email in Java but when I read the body
I am trying to send my dynamically created silverlight 2 page/image to a an

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.