4 Answers, 1 is accepted
0
Accepted
Tom Mieck
Top achievements
Rank 1
answered on 27 Oct 2012, 05:03 AM
Hi,
Please find the code below
public class MultyColumnComboBoxEditor : BaseInputEditor
{
public RadGridView Grid
{
get
{
return ((RadMultiColumnComboBoxElement)this.EditorElement).EditorControl;
}
}
public override object Value
{
get
{
return ((RadMultiColumnComboBoxElement)this.EditorElement).SelectedValue;
}
set
{
((RadMultiColumnComboBoxElement)this.EditorElement).SelectedValue = value;
}
}
public override void BeginEdit()
{
base.BeginEdit();
this.EditorElement.Focus();
((RadMultiColumnComboBoxElement)this.EditorElement).SelectedValueChanged += new EventHandler(MultyColumnComboBoxEditor_SelectedValueChanged);
}
public object DataSource
{
get
{
return ((RadMultiColumnComboBoxElement)this.EditorElement).DataSource;
}
set
{
((RadMultiColumnComboBoxElement)this.EditorElement).DataSource = value;
}
}
public string DisplayMember
{
get
{
return ((RadMultiColumnComboBoxElement)this.EditorElement).DisplayMember;
}
set
{
((RadMultiColumnComboBoxElement)this.EditorElement).DisplayMember = value;
}
}
public bool AutoFilter
{
get
{
return ((RadMultiColumnComboBoxElement)this.EditorElement).AutoFilter;
}
set
{
((RadMultiColumnComboBoxElement)this.EditorElement).AutoFilter = true;
((RadMultiColumnComboBoxElement)this.EditorElement).AutoFilter = value;
}
}
public string ValueMember
{
get
{
return ((RadMultiColumnComboBoxElement)this.EditorElement).ValueMember;
}
set
{
((RadMultiColumnComboBoxElement)this.EditorElement).ValueMember = value;
}
}
void MultyColumnComboBoxEditor_SelectedValueChanged(object sender, EventArgs e)
{
this.OnValueChanged();
}
public override bool EndEdit()
{
((RadMultiColumnComboBoxElement)this.EditorElement).SelectedValueChanged -= new EventHandler(MultyColumnComboBoxEditor_SelectedValueChanged);
return base.EndEdit();
}
protected override RadElement CreateEditorElement()
{
RadMultiColumnComboBoxElement mccb = new RadMultiColumnComboBoxElement();
if (mccb.MultiColumnPopupForm.BindingContext == null)
{
mccb.MultiColumnPopupForm.BindingContext = new BindingContext();
}
return mccb;
}
public override Type DataType
{
get { return typeof(string); }
}
}
put this code in the editorrequired event in the propertygrid
void radPropertyGrid1_EditorRequired(object sender, PropertyGridEditorRequiredEventArgs e)
{
MultyColumnComboBoxEditor mccb = new MultyColumnComboBoxEditor();
e.EditorType = typeof(MultyColumnComboBoxEditor);
datatable employee= getdata();
mccb.DisplayMember = "Name";
mccb.ValueMember = "ID";
mccb.DataSource = employee
;
e.Editor = mccb;
mccb.AutoFilter = true;
}
let me know if u have any other questions
Please find the code below
public class MultyColumnComboBoxEditor : BaseInputEditor
{
public RadGridView Grid
{
get
{
return ((RadMultiColumnComboBoxElement)this.EditorElement).EditorControl;
}
}
public override object Value
{
get
{
return ((RadMultiColumnComboBoxElement)this.EditorElement).SelectedValue;
}
set
{
((RadMultiColumnComboBoxElement)this.EditorElement).SelectedValue = value;
}
}
public override void BeginEdit()
{
base.BeginEdit();
this.EditorElement.Focus();
((RadMultiColumnComboBoxElement)this.EditorElement).SelectedValueChanged += new EventHandler(MultyColumnComboBoxEditor_SelectedValueChanged);
}
public object DataSource
{
get
{
return ((RadMultiColumnComboBoxElement)this.EditorElement).DataSource;
}
set
{
((RadMultiColumnComboBoxElement)this.EditorElement).DataSource = value;
}
}
public string DisplayMember
{
get
{
return ((RadMultiColumnComboBoxElement)this.EditorElement).DisplayMember;
}
set
{
((RadMultiColumnComboBoxElement)this.EditorElement).DisplayMember = value;
}
}
public bool AutoFilter
{
get
{
return ((RadMultiColumnComboBoxElement)this.EditorElement).AutoFilter;
}
set
{
((RadMultiColumnComboBoxElement)this.EditorElement).AutoFilter = true;
((RadMultiColumnComboBoxElement)this.EditorElement).AutoFilter = value;
}
}
public string ValueMember
{
get
{
return ((RadMultiColumnComboBoxElement)this.EditorElement).ValueMember;
}
set
{
((RadMultiColumnComboBoxElement)this.EditorElement).ValueMember = value;
}
}
void MultyColumnComboBoxEditor_SelectedValueChanged(object sender, EventArgs e)
{
this.OnValueChanged();
}
public override bool EndEdit()
{
((RadMultiColumnComboBoxElement)this.EditorElement).SelectedValueChanged -= new EventHandler(MultyColumnComboBoxEditor_SelectedValueChanged);
return base.EndEdit();
}
protected override RadElement CreateEditorElement()
{
RadMultiColumnComboBoxElement mccb = new RadMultiColumnComboBoxElement();
if (mccb.MultiColumnPopupForm.BindingContext == null)
{
mccb.MultiColumnPopupForm.BindingContext = new BindingContext();
}
return mccb;
}
public override Type DataType
{
get { return typeof(string); }
}
}
put this code in the editorrequired event in the propertygrid
void radPropertyGrid1_EditorRequired(object sender, PropertyGridEditorRequiredEventArgs e)
{
MultyColumnComboBoxEditor mccb = new MultyColumnComboBoxEditor();
e.EditorType = typeof(MultyColumnComboBoxEditor);
datatable employee= getdata();
mccb.DisplayMember = "Name";
mccb.ValueMember = "ID";
mccb.DataSource = employee
;
e.Editor = mccb;
mccb.AutoFilter = true;
}
let me know if u have any other questions
0
Randy
Top achievements
Rank 1
answered on 29 Oct 2012, 01:03 PM
Thanks, that was exactly what I needed!
0
Hello Tom and Randy,
Thank you both for writing.
Tom's solution is exactly the way to go in the situation.
If you have further questions, do not hesitate to write back.
Kind regards,
Ivan Petrov
the Telerik team
Thank you both for writing.
Tom's solution is exactly the way to go in the situation.
If you have further questions, do not hesitate to write back.
Kind regards,
Ivan Petrov
the Telerik team
0
Tom Mieck
Top achievements
Rank 1
answered on 31 Oct 2012, 03:54 PM
Hi randy,
I have one question,please help me out.
In propertygrid , when user expand and collapse one category section the order of the items getting dispersed
lets say i have category1 which contains employee,department fields(----this is the default order am showing)
order:
category1:
employee
department
when user clicks on arrow icon(it will collapse that section,and again click on the same icon ) then items order of the items is changing i.e department,employee
changed order:
category1:
department
employee
department coming first, followed by employee field.
I dont want that behaviour even when user clicks on expand and collapse arrow icon
I have one question,please help me out.
In propertygrid , when user expand and collapse one category section the order of the items getting dispersed
lets say i have category1 which contains employee,department fields(----this is the default order am showing)
order:
category1:
employee
department
when user clicks on arrow icon(it will collapse that section,and again click on the same icon ) then items order of the items is changing i.e department,employee
changed order:
category1:
department
employee
department coming first, followed by employee field.
I dont want that behaviour even when user clicks on expand and collapse arrow icon