==========================================================
This example is now obsolete. Refer to the How to represent an enumeration property via a drop-down box with check boxes one instead.
==========================================================
This example demonstrates how to implement property editors using our ASPxCheckBox and ASPxRadioButton controls to manage simple enumeration and flags properties:
[C#][Flags]publicenumComboboxEnum{None= 0,Value1= 1,Value2= 2 };publicenumRadioButtonEnum{Value1,Value2};[DefaultClassOptions]publicclassSampleObject:BaseObject{publicSampleObject(Sessionsession):base(session){}privateComboboxEnum_comboboxEnumProperty;publicComboboxEnumComboboxEnumProperty{get{return_comboboxEnumProperty;}set{SetPropertyValue("ComboboxEnumProperty",ref_comboboxEnumProperty,value);}}privateRadioButtonEnum_radioButtonEnumProperty;publicRadioButtonEnumRadioButtonEnumProperty{get{return_radioButtonEnumProperty;}set{SetPropertyValue("RadioButtonEnumProperty",ref_radioButtonEnumProperty,value);}}}
See Also:
Display a Property Via the Required Editor
Implement Custom Detail View Item
How to: Implement a Property Editor for a Web Site
How to: Implement a Property Editor for Windows Applications
How to bind a control in EditForm template to XPObject enumerable field
Question Comments
Added By: Sandro Welter (Intelligix) at: 11/8/2012 12:24:10 PM
How to set this example as favorite?
Added By: Mohamed AIT LAHMID at: 2/21/2013 5:37:39 AMThank you for your help.
I used RadioButtonEnumPropertyEditor :
[Flags]
public enum TopRecherche { Taxe = 0, Redevable = 1, LieuImposition = 2 };
//..
TopRecherche topRecherche;
[ImmediatePostData]
[ModelDefault("PropertyEditorType", "iclRegie.Module.Web.Editors.RadioButtonEnumPropertyEditor")]
public TopRecherche TopRecherche
{
get { return topRecherche; }
set
{
if (!IsLoading && !IsSaving && value != topRecherche)
{
redevable = null;
}
}
}
p_Redevables redevable;
[ImmediatePostData]
public p_Redevables Redevable
{
get { return redevable; }
set
{
SetPropertyValue<p_Redevables>("Redevable", ref redevable, value);
}
}
But the value of the property 'Redevable' is not changed when i changed the value of 'TopRecherche' in web page.
Added By: Sabine Dijt at: 8/27/2013 2:40:20 AMIf I add more options to the enum it doesn't save right. It automatically checks every other option.
I'm using v13.1.5 btw. Is there any reason it wouldn't work in this version?
Can you post the equivalent code for v2013 vol 1.8?
Added By: Pauline Abou haidar at: 9/3/2014 4:20:12 AMHi,
Please for the lines
radioButton.CheckedChanged += New EventHandler(AddressOf radioButton_CheckedChanged)
radioButton.CheckedChanged -= New EventHandler(AddressOf radioButton_CheckedChanged)
i need the equivalent in vb.net
and why if i put immediatepostdata= true for a property of radiobuttonenumpropertyeditor, it refreshes the selected value to the default every time i try to choose one.
Thanks and best regards
Added By: Dennis (DevExpress Support) at: 9/3/2014 12:43:26 PM@Pauline:
Hese is the VB.NET code you are looking for:
[VB.NET]AddHandler radioButton.CheckedChanged, AddressOf radioButton_CheckedChanged RemoveHandler radioButton.CheckedChanged, AddressOf radioButton_CheckedChanged
As for the behavior you described, it looks like an issue in this implementation. However, it is now obsolete and we no longer support this example code. I suggest you refer to the latest example mentioned in example's description.