Share via


Radiobuttons and groupname in asp.net 2.0 RC0

So after I ported an internal site of my teams from 1.1 to 2.0 I found an issue.  We have a page that is a hacked together wizard.  This wizard uses one page for all the steps, it has a handful of controls on it (from labels to textboxes).  At each step of the wizard will hide or un-hide items as needed.

One thing that it also did is group radiobuttons.  Let’s say in step 1 we use 3 radio buttons and they need to be grouped.  So they are grouped like

  • rdobutton1.groupname = "step1"
  • rdobutton2.groupname = "step1"
  • rdobutton3.groupname = "step1"

We have a button (next) that finds out which step we are in and process the input and determines if we move to the next step.

On step two lets say we only needed 2 radio buttons.  So we set visible = false on the ones we don’t need and set the new group name on the 2.

  • rdobutton1.groupname = "step2"
  • rdobutton2.groupname = "step2"

then you hit our next button again.  Except.  The state (checked or unchecked) of the radiobuttons did not make it past page_init into page_load.  If you hit next again (because our wizard would say no options were selected) it would work. After some digging we find that some changes in 2.0 do not like it when you change the groupname between page_loads.  The work around:  Don't change groups names or make the changes in page_int.   So I just set mine all to an integer of 1 in each step.  It worked the second time you hit the next button because the groupname was not changed on that round. 

It is unknown if this will be fixed by the time we RTM.