Sunday, July 29, 2007

Last Sequel: Mutually Exclusive Radiobuttons in INamingContainer

If you are still bitten by the non-mutually exclusive radiobutton bug; and don't want to go the long way of creating your own custom radiobutton class, here is a quick and dirty way of achieving the same result by some simple javascript. The idea is to walk up the DOM chain on click of the radiobutton and uncheck the other radio buttons. The javascript works great for DataGrid, DataList and GridView controls, controls which spit out the final html as a table; and as with any javascript code, will only work if javascript is enabled; here's a working example and below is the page's source:

No comments:

Post a Comment