I am looking to do exactly what the title states. I have a radio field that i would like to persist across a page refresh. The following is my code:

<div id="RadioFields">
    <input type="radio" name="country" value="usa" id="usa" />USA
    <input type="radio" name="country" value="foreign" id="foreign" />Foreign Country
 <div id="countryerror">
  <div class="asterisk" runat="server">
    <asp:Label ID="lblCountry" runat="server" Visible="false" Text ="Please choose an option." >
    </asp:Label>
  </div>
 </div>
</div>

Recommended Answers

All 2 Replies

And what are you using? Because by itself HTML is stateless, you reload the page and it will draw itself as specified in the HTML, which in your case, is with neither radio button selected.
You would need either sessions, cookies or some other form of postback

If it is asp.net, you may be looking a functionality that has similar behavior to include in PHP (but not exact) here. In other words, create a generic file to be included in other files.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.