Firefox refresh page retaining checkbox/radiobutton values

I had a page which uses codebehind Page_Load and (!IsPostBack) to setup all the controls on the page depending on what was being loaded. This worked fine, apart from when I refreshed the page (F5) in Firefox 3.5 – IE was okay.

Firefox seems to retain all the input selections – eventhough from the code behind I was ressetting them.

The only way I found to resolve this was to call a reset on the form (actually in my Master page) in the document ready function of JQuery which solves the problem.

$(document).ready(function() {

$(“#<%= (form1.ClientID) %>”)[0].reset();

});

Problem with ASP.Net & Radiobuttons in repeaters/datalists/datagrids all being selectable

RadioButtons place on a page inside a repeating control (repeater/datalist/datagrid), you set the group but they are still all individually selectable.

I have come across this problem before, which was fixed using some client side script added to the radiobuttons, but this had to be done for each radiobutton group as I added them and was a bit of a pain.

I have recently found a much better solution here -> http://www.codeproject.com/KB/webforms/How_group_RButtons.aspx

Works perfectly well. Unstructions:

1) Just download the zip file at the top of the page.

2) Unzip and place the file (GroupRadioButton.dll) into your bin folder.

3) Add a reference to the assembly into your web.config or .aspx page as below:

<%@ Register TagPrefix=”vs” Namespace=”Vladsm.Web.UI.WebControls” Assembly=”GroupRadioButton” %>

Use the control on your page as you would a RadioButton

<vs:GroupRadioButton id=”MyRbn” runat=”server” GroupName=”MyRbnGrp” />

Thats it. Brilliant 🙂

Kudos to Vladimir Smirnov.