locked
selected option doesn't reset RRS feed

  • Question

  • User-2060576634 posted

    hi everybody..

    I have a select input field with a few options. when i select an option and refresh the page, the options don't get reset and stay selected (at least in Firefox). is there a way to force the browser to reset the selected options?

    Wednesday, June 3, 2015 4:30 PM

Answers

  • User724169276 posted

    If it's select input field then use selected property , then if you refresh your page , everytime it will get back to default selected option.

    <select>
      <option value="volvo">Volvo</option>
      <option value="saab">Saab</option>
      <option value="opel" selected>Opel</option>
      <option value="audi">Audi</option>
    </select>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 4, 2015 4:01 AM

All replies

  • User724169276 posted

    If it's select input field then use selected property , then if you refresh your page , everytime it will get back to default selected option.

    <select>
      <option value="volvo">Volvo</option>
      <option value="saab">Saab</option>
      <option value="opel" selected>Opel</option>
      <option value="audi">Audi</option>
    </select>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 4, 2015 4:01 AM
  • User-1780421697 posted

    if it is asp.net dropdownlist control then disable its viewstate property.

    Thursday, June 4, 2015 4:13 AM