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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:45:26+00:00 2026-06-17T06:45:26+00:00

Ok, so I have been spinning my wheels on this one for a long

  • 0

Ok, so I have been spinning my wheels on this one for a long time now, and as usual, i am sure that this is a really simple fix, so here goes…

I need to set a javascript variable using a variable from my code-behind file. Normally, I do it as follows:

var Test = <%= TestVar%>

On a normal page load, this method (while probably not the best way to do it) works great for me. The problem that I am now having, is that I need to change the variable on a callback with a callback/update panel. What I have, is the variable is set in a javascript block in the page header, and I then call a function that utilizes the variable on the callback panel’s EndCallback event.

var Var1 = <%= Var1%>;
function endCallback()
{
    //some action with Var1;
}

Everything runs great, except that the server tag is not reloaded (because I am not doing a full page postback). Is there a better way to update a javascript variable on a partial postback?

  • 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-17T06:45:28+00:00Added an answer on June 17, 2026 at 6:45 am

    If you want to change a server variable, you need an ajax call.
    Using jquery or another method.
    On server-side you need to create a method, maybe a web service. And then invoke it from the client-side sending the new value.

    client side:

    $.ajax({
       url: "(webservice url)",
       data:(parameters if needed),
       success:function(response){
            variable = response;
       }
    });
    

    server-side:

    [WebMethod()]
    public object GetValue(object param1){
       ...
       return new_value;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been spinning my wheels now for awhile trying to figure out how
I've been scratching my head over this for a long time now and searched
I have been using TortoiseSVN for some time and I really like it. I
I have been spinning my wheels for a couple hours on why when I
I have been spinning my wheels trying to figure out why my php code
I have been using rails for almost 4 years now in in all that
I've been spinning on this for 2 hours now, so thought I'd post here
I've been chasing my tail on this one. I have a single table (keeping
I've been helplessly observing this problem for a couple months now, and have decided
Have been trying to encrypt an xml file to a string so that I

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.