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 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 have some C# / asp.net code I inherited which has a textbox which
I'm refactoring some code I inherited from a long-gone developer, and I find this:
I'm seeing some code I've inherited that looks like the following: @interface SomeClass (private)
I came across some Enumerators that inherited uint . I couldn't figure out why
I've inherited a rather large application that really could use some cleanup. There is
i inherited this code from some-one and this only returns the first row it
I have inherited some legacy PHP code what was written back when it was
I've inherited some aspx (including the web.config file) and am getting the following error.
In some code I've inherited, I see frequent use of size_t with the std
I have inherited a middle tier system with some multi-Threading issues. Two different threads,

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.