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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:32:30+00:00 2026-05-25T10:32:30+00:00

Specifically, I have an ascx control, let’s assume it injects the javascript var x=5

  • 0

Specifically, I have an ascx control, let’s assume it injects the javascript var x=5.

The ascx control contains a button, which when clicked does x++;

x is then 6.

When someone puts my control on their page, and clicks a button that posts back (the button is their own), I want to let them retrieve the value of x in the code behind.

Is there a solution that would allow this? The closest I can think of is to put a hidden field in the ascx, and store the value in the hidden field when it is updated. Then in my codebehind, on postback, I can do myControl.hiddenField.value to retrieve the result.

I haven’t tried this yet as I am wondering if there is a better way. Also I’m not sure if the updated value of hidden field will register when it is altered via javascript, although being a post, I would hope it is.

Thoughts?

Edit: In fact, using a getter I could hide away the hidden field and just allow direct access to the value… if that solution is the best…

  • 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-25T10:32:30+00:00Added an answer on May 25, 2026 at 10:32 am

    Yes, your own answer is the best one…especially with your edit! Form fields are how these two tiers communicate with one another. You could potentially invoke an ajax post with a some dynamically built get / post parameters, but this wouldn’t be any better…

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

Sidebar

Related Questions

Does anyone know how to do this? Specifically I have two arrays and some
Specifically I have a PHP command-line script that at a certain point requires input
I'm relatively new to java (specifically swing) and have recently been making some fairly
Are there any compression algorithms -- lossy or lossless -- that have been specifically
They're both resizable arrays, and std::basic_string doesn't have any specifically character-related functions like upper().
I have a database that I used specifically for logging actions of users. The
I have a custom list in SharePoint (specifically, MOSS 2007.) One field is a
Specifically, I have a model that has a field like this pub_date = models.DateField(date
We have had issues with Mootools not being very backward compatible specifically in the
I have been looking into the Castle project and specifically Windsor. I have been

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.