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

  • Home
  • SEARCH
  • 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 8308983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:58:10+00:00 2026-06-08T18:58:10+00:00

I’m working on a mobile search, that uses your location to determine a zip

  • 0

I’m working on a mobile search, that uses your location to determine a zip code server side, but when trying to set two labels to the latitude and longitude to send to the server, I get an error claiming that the innerHtml is null. Upon further inspection, the element is null. Why could this be?

<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Search.Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script language="javascript" type="text/javascript">
    navigator.geolocation.getCurrentPosition(foundLocation, noLocation);
    var latitude;
    var longitude;
    function foundLocation(position) {
        latitude = position.coords.latitude;
        longitude = position.coords.longitude;
        alert('Your location: ' + latitude + ', ' + longitude);
    }
    function noLocation() {
        //Do something here in the case that no location is found, or user denies access
    }
    function getLocation() {
        document.getElementById("ct100_ContentPlaceHolder1_lblLat").innerHtml = latitude;
        document.getElementById("ct100_ContentPlaceHolder1_lblLong").innerHtml = longitude;
    }
</script>   
<div data-role="page">
    <div data-role="header">
        <h1>Provider Search</h1>
    </div>
    <div data-role="content">
        <asp:Button ID="btnSearch" Text="Search" runat="server" data-role="button" OnClientClick="getLocation()" OnClick="btnSearch_Clicked"></asp:Button>
        <asp:Label ID="lblLat" runat="server"></asp:Label>
        <asp:Label ID="lblLong" runat="server"></asp:Label>
        <p></p> 

    </div>

</div>

</asp:Content>

I’d like to note that everything in this document is working perfectly, except for the setting of the labels.

Also, the ID prefix ct100_ContentPlaceHolder1_ is generated by asp.net during runtime, and this can be confirmed by looking at the page source when I am debugging.

Any help?

  • 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-08T18:58:11+00:00Added an answer on June 8, 2026 at 6:58 pm

    In your getLocation() function could you try doing the following:

    function getLocation() {
        $('#<%=lblLat.ClientID%>').html(latitude);
        $('#<%=lblLong.ClientID%>').html(latitude);
    }
    

    You could also try setting the text property of both labels in a similar manner:

    function getLocation() {
        $('#<%=lblLat.ClientID%>').text(latitude);
        $('#<%=lblLong.ClientID%>').text(latitude);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.