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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:10:51+00:00 2026-06-05T21:10:51+00:00

I want to access java script’s return value , which in is in a

  • 0

I want to access java script’s return value , which in is in a variable and a label, i want to use it in .cs file, how do i do that? I have fetch the out put of javascript in a variable and also a label control of asp.net… I get the values both the ways, but in need it .cs file to save it in my data bsae, help me please.. Thank u

<script language=Javascript>
    function setup_ip(json) {
        var htmlx = " Your IP Address: <b>" + json.IP;
        htmlx += "</b> | Country: " + json.countryName;
        if (json.cityName != "Unknown" || json.regionName != "Unknown") {
            htmlx += " | City: " + json.cityName + " / " + json.regionName;
            var s = " | City: " + json.cityName + " / " + json.regionName;
        } else {
            htmlx += " | Your Time: " + json.localTimeZone;
        }

        $("#myipx").html(htmlx);
     //   $('#<%= lbl1.ClientID %>').text(htmlx);
        $('#<%= lbl1.ClientID %>').text(s);

       // var txtCountry = document.getElementById('<%=lbl1.ClientID %>');        

    }

    $(document).ready(function() {


        EasyjQuery_Get_IP("setup_ip", "full");

    });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <div class="inner">
<p class="welcome-message">
<a href="http://www.easyjquery.com/detect-get-clients-ip-address-country-using-javascript-php/"id="topid" title="Javascript, PHP jQuery API Detect Clients IP Address and Country - Geo Location"   >
<asp:Label ID="myipx" runat="server"  ClientIDMode="Static"></a></asp:Label>Detecting Clients IP Address - Country - City</span>
<br />
<asp:Label ID="lbl1" runat="server"  ClientIDMode="Static"></asp:Label>
                </p>
                 <asp:TextBox ID="txtCountry" runat="server"></asp:TextBox>


            <!-- END #footer-texture -->
            </div>

    </div>
    </form>
</body>
  • 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-05T21:10:54+00:00Added an answer on June 5, 2026 at 9:10 pm

    To use this values you have following options :

    1.)As label is your server side control you can easily access label text value in .cs file so main issue with javascript variable here you can assign this value to asp:hidden field so you can also access this in .cs file like :

    <script language=Javascript>
    function setup_ip(json) {
    
    $("#hdn").val('your javascript variable');
    }
    </script>
     <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" ScriptMode="Release">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpnlHidden" runat="server">
        <ContentTemplate>
            <input runat="server" type="hidden" id="hdn" value="0" />
        </ContentTemplate>
    </asp:UpdatePanel>
    

    cs file :

      string str = hdn.value//Where ever you want to store value
    

    2.)Another option you can use pagemethod here and pass both values as parameter to .cs file.

    javascript :

      PageMethods.getValue(parameter1,parameter2, OnSucceeded, OnFailed);
    function OnSucceededID(result, methodName)
    {
       //get result back if you want after successfully execution of pagemethod on server side  
    }
    
     function OnFailedID(error, methodName) {
            if (error !== null) {
               alert(error.get_message());
            }
        }
    

    CS file :

       [WebMethod(enableSession: true)]
        public static returntype getValue(parameter type parameter1,parameter type parameter2)
        {
            do what you want to do with these values.
    
        }
    

    Hope it helps you.

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

Sidebar

Related Questions

I want the value of JavaScript variable which i could access using PHP. I
I want to access drop down menu's variable in java script on change event,
i want to access a javascript function which resides in a script file from
I have a JavaScript, which returns 2 variables. I just want to access those
I want to use a Groovy script to access a webpage. However I'm behind
I have an ActionScript program that I want to access some external JavaScript functions.
I want to access PHP(server side file variables) with JavaScript(Client side script) without using
I want to access the following array @names in my java script as json
I want to access a boolean property of my User Control through Java Script.
I want to defined a variable/parameter in CSS and access it by javascript. What

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.