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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:06:02+00:00 2026-06-14T19:06:02+00:00

I have code like below in ASP.Net MVC4. and I am using Razor engine.

  • 0

I have code like below in ASP.Net MVC4. and I am using Razor engine.

@{
    string sDefaultEnvironId = string.Empty;

} 
<script language="javascript" type="text/javascript" >
    function changeHd() {
        $("#hdSelEnvironmentId").val("1");
    }
</script>
<input type="button" value="ChangeHD" onclick="changeHd();" />
@Html.Hidden("hdSelEnvironmentId", sDefaultEnvironId)

The value of hidden field hdSelEnvironmentId is empty when accessing this view at first time. then it was changed to 1 after I clicked button ChangeHD.
But after I pressed F5, the value of hidden field hdSelEnvironmentId is still 1, I expected it with initial empty value instead of 1. Can anyone help me to figure it out ?I just can not understand it. I am using Firefox and Firebug, thanks.

  • 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-14T19:06:03+00:00Added an answer on June 14, 2026 at 7:06 pm

    Edit As discovered by Andreas here, you can remove this behavior by adding an attribute autocomplete=off to your input:

    @Html.Hidden("hdSelEnvironmentId", sDefaultEnvironId, new { autocomplete = "off" })
    

    This effect is not due to the cache — it’s a feature (bug?) of Firefox, that when you refresh a page, the inputs of the page do not seem to get re-loaded from the server.

    • try the same thing in Chrome or IE, you’ll see that the value resets to empty
    • clear the cache in Firefox, and you’ll notice the value still does not get reset.

    So, I’m not sure if there’s a workaround, but this issue does seem to be restricted to Firefox.

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

Sidebar

Related Questions

Say you have javascript code sample like below in asp.net page body onload event.
I've an annoying ASP.NET problem: I have a Perl script (see below), which gets
I have asp.net chart intervel issue. I am feed data to chart like below
In my ASP.NET MVC application, in my _ViewStart.cshtml file, I have code like the
I am using Asp.Net Mvc3 and the unobtrusive jquery validation. I'd like to have
I have code to read a response from an ASP.NET Web API, like so:
I have a standard code like below to validate xml against xsd, but it
I have a code like this below, which gives me a $link that equals
I have a code like this below in /root_project/main.cpp : #include theoraplayer/TheoraVideoClip.h unsigned int
I have code that looks more or less like the code below but it

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.