.Net Links

Tuesday, November 3, 2009

How to customize Filter Menu for ComboBoxColumn inside the grid


The below event and function will help to customize Filter Menu for ComboBoxColumn to User defined values in a Grid.

The below codes will populate the Filter ComboBoxColumn with values "Yes" / "No" instead of deafault value "Checked / Unchecked"


The below Event is raised which will enable the cells editors displayed within the auto filter row cells to be initialized.

//Event to be raised
Grid.AutoFilterCellEditorInitialize +=new ASPxGridViewEditorEventHandler(gvSubstitutions_AutoFilterCellEditorInitialize);

// Function to replace the text Checked /Unchecked wiht Yes/No in the filter of the ASPxComboBox column
protected void gvSubstitutions_AutoFilterCellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e)
{
if (e.Column.FieldName == "Active")
{
(e.Editor as ASPxComboBox).Items.Clear();
(e.Editor as ASPxComboBox).Items.Add("Yes", true);
(e.Editor as ASPxComboBox).Items.Add("No", false);
}
}

Labels: , , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home