Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

CheckBoxList - How to emulate RadioButtonList that allows users to unselect items

$
0
0

Unfortunately, RadioButtonList does not allow handling the click event for a separate item. Thus, it is better to use CheckBoxList to allow users to unselect items. Handle the SelectedIndexChanged event to emulate the RadioButtonList behavior in the following way:


[JScript]
function OnCBLSelectedIndexChanged(s, e){ s.UnselectAll();if(e.isSelected) s.SetSelectedIndex(e.index);else s.UnselectIndices(e.index);}

Then, customize the control's images using the SpriteProperties property and specifying the corresponding theme name in the prefix of a CSS class:


[C#]
settings.Properties.UncheckedImage.SpriteProperties.CssClass="dxEditors_edtRadioButtonUnchecked_DevEx";settings.Properties.CheckedImage.SpriteProperties.CssClass="dxEditors_edtRadioButtonChecked_DevEx";

See Also:
ASPxCheckBoxList - How to emulate ASPxRadioButtonList that allows users to unselect items


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>