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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:55:07+00:00 2026-05-19T23:55:07+00:00

I inherited some JavaScript that I was told to integrate into our ASP.NET site.

  • 0

I inherited some JavaScript that I was told to integrate into our ASP.NET site. I thought this would be straightforward but it’s turning out to be a bit of a challenge.

The code looks something like this:

<SELECT id="Question1" name="Question" onchange="updateQuestion();">                 
<OPTION value="notChosen">--Please Select One--</OPTION>
<OPTION value="in">India</OPTION>
<OPTION value="de">Germany</OPTION>                     
<OPTION value="fr">France</OPTION>                
<OPTION value="us">United States</OPTION>                     
<OPTION value="ch">Switzerland</OPTION>                
</SELECT> 

The goal is to get the value from this HTML control into ASP.NET, however this control itself is being dynamically generated by another chunk of javascript, so I can’t just change this to an asp.net control. My solution was to add the onchange=”updateQuestion();” method, this JS will take these SELECT tags and place the values into an ASP.NET control:

function updateSecQ() {
    var sQuestion = document.getElementById('<%=sQuestion.ClientID%>');
    sQuestion.Value = "";
    var questions = document.getElementsByName('Question');
    for (question in questions) {
        if (questions[question].value != null)
            sQuestion.Value += questions[question].value + ",";
    }
    alert(sQuestion.Value);
}

As you can see, that’s looking to update an ASP.NET control:
<asp:HiddenField ID="sQuestion" runat="server" value="" />

This appears to all work, however when I goto the server side on the form submit I see that sQuestion.Value is still = “”.

I’m not quite sure what I’ve done wrong here, any input would be much appreciated. Thank you for your time.

  • 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-19T23:55:08+00:00Added an answer on May 19, 2026 at 11:55 pm

    Dunno about ASP.net, but I know in the browser DOM, a hidden field’s value is value all lower case, not Value. It’s the value attribute that the browser will submit, and by setting sQuestion.Value, you’ve failed to set its submitted value.

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

Sidebar

Related Questions

I've inherited a high-traffic site that loads some Ext javascript files and I'm trying
I've inherited an ASP.NET web site that has an SSL certificate bought via GoDaddy.
I've inherited a project with some nasty JavaScript that depends on hard coded object
I'm writing some javascript (a greasemonkey/userscript) that will insert some input fields into a
I have inherited some Classic ASP code and I need a JSON library that
I am working on dynamically creating some JavaScript that will be inserted into a
I've inherited some code on a system that I didn't setup, and I'm running
I've inherited some windows-mobile code that I've been bringing up-to-date. I've come across a
I've inherited some code which breaks a page up into tabs using divs. On
I have some javascript code that is used in a few different pages in

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.