Despite my recent lack of postings I am still alive!! 🙂
Anyway, the other reason for this post is to spread/share the knowledge about radio buttons, AJAX and postback. In my monster control, I have a few radio buttons that let the user switch between filters, but obviously when the page loads I want a default filter to be shown. Correspondingly I want one of the radio buttons to be checked. “Easy!” you say, and, well, yes it is, and it might look something like:
<asp:RadioButton ID="RadioButton1" runat="server" GroupName="group1" Text="Option 1" Checked="true" OnCheckedChange="RadioButton1_CheckedChanged"/>
But is it quite that simple? When a radio button is selected, I want to do some stuff server-side and show a different filter through the magik of AJAX. The code above might work for buttons 2 and 3, but there is a distinct lack of action when button 1 is re-selected (after selecting 2 or 3). “Huh?” you say? The reason for this is the
Read this article for more info (it helped me win this particular battle with the monster): http://smarx.com/posts/the-case-of-the-radiobuttonlist-half-trigger.aspx.
I fight on….