Today saw a great AM where I cranked out a lot of work on an ASP.NET upgrade. A final run-through of the new features in the early afternoon, then upload to HQ and get the heck out of my office to walk the dogs and enjoy a beautiful September day in Vermont. It was one of those days where I started early and kept pushing it, working through lunch, and not stopping to go to the bathroom.
But just when I thought I was done, I noticed a control's radiobuttonlist was not being updated after a autopostback from a dropdownlist onselectindexchanged event in the same control. It was all over for me then. I had to make this darn radiobuttonlist work correctly. My afternoon was gone. Here it is, after midnight, and I probably spent another hour or so on it tonight as well.
I read a number of posts on google about the radiobuttonlist and onpostback behavior (or lack thereof) with a lot of people saying it was a bug in the framework. I personally don't think so, and attribute my problems to a combination of an incomplete understanding of the “Life Cycle of an ASPX page” along with under the covers databinding behavior I'm missing. The radiobuttonlist was not bound to anything, but had two <listitem...> items listed in the ASPX. It seems a simple enough request to use rbtn1.Items.FindByValue("1").Selected = true; on the onselectindexchanged method to change the radiobutton item checked.
Sufficiently whooped, to get the autopostback behavior I wanted, I replaced the radiobuttonlist with a dropdownlist and bound the dropdownlist to an XML file. I also rebound the dropdownlist on the autopostback spawned by the other dropdownlist's onselectindexchanged event. This did the trick.