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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:12:28+00:00 2026-06-14T09:12:28+00:00

Possible Duplicate: How to share a variable between C# and JavaScript? I am enhancing

  • 0

Possible Duplicate:
How to share a variable between C# and JavaScript?

I am enhancing a C# ASP.NET web app that has two important divisions in the HTML. Two menu options are available to cause one to be hidden and the other to be unhidden. Let’s call them Page One and Page Two.

The problem is that some things on the page cause a postback, which causes a total refresh and forces the default to be Page One. Also we automatically do a refresh every five minutes to get new page content. If the user happens to be viewing Page Two when the refresh occurs either automatically or because of a postback after the user has clicked on certain things, the page automatically goes back to Page One.

Long term the solution is to properly use AJAX. For now I need a quick and dirty way to remember which page the user is on when a refresh occurs and then put him back on that page upon refresh.

Can I create a variable on the server side in C# that I can interrogate on the client side with JavaScript? Technically the server does not need to know which page div is displayed in the browser if I can somehow make the client remember it from page refresh to refresh. Is there a way to do that?

Forgive me if this seems elementary. I have many years of programming experience (mostly C/C++ in the MS-DOS and Unix worlds), but not very much in the ASP.NET environment.

  • 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-14T09:12:30+00:00Added an answer on June 14, 2026 at 9:12 am

    If you are using meta tag to refresh the page <meta http-equiv="refresh" content="600"/>, then you should pass a tab/page id along with the url:

    <meta http-equiv="refresh" content="600;url=http://yourdomain.com/page.html?tab=<%= tab %>/">
    

    Also add this attribute when you send any postback to the page.

    Now, you just need to read a value of this attribute on the server side and replace it in the meta refresh tag:

    tab = Request.QueryString["tab"]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Can you share a file and it's history between two git repositories?
Possible Duplicate: && operator in Javascript In the sample code of the ExtJS web
Possible Duplicate: Pass a PHP string to a Javascript variable (and escape newlines) I
Possible Duplicate: ASP.NET Application state vs a Static object I am using the static
Possible Duplicate: Difference between ref and out parameters in .NET When to use ref
Possible Duplicate: Call controller's function from another controller / Share data between controllers I
Possible Duplicate: Inconsistent behavior on java's == Integer wrapper objects share the same instances
Possible Duplicate: How to avoid “!= null” statements in Java? Share your thoughts..
Possible Duplicate: NSLayoutConstraint crashes ViewController recently after updating Xcode my app now fails to
Possible Duplicate: Can a local variable’s memory be accessed outside its scope? #include <iostream>

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.