Hi, Mike
I am trying the method you proposed in the post http://community.infragistics.com/forums/p/55961/287029.aspx#287029, "hide the "real" column which contains a single string and use an unbound column whose datatype is List<string> for display to the user. You could then use events of the grid to convert the string to a list (InitializeRow) and the list to a String (BeforeRowUpdate)."
During the test, i found the text in the ultraComboEditor disappeared when the cell lose focus, the cell changed to blank. i pasted some code here,
private void ultraGrid1_InitializeLayout(object sender, IWG.InitializeLayoutEventArgs e)
{
// override the backgroud color of the active cell.
this.ultraGrid1.DisplayLayout.Override.ActiveRowCellAppearance.BackColor = Color.White;
this.ultraGrid1.DisplayLayout.Override.ActiveRowCellAppearance.ForeColor = Color.Black;
this.Columns[StrValue].Hidden = true; // hide the real bound column
this.Columns.Add(m_fakeColName, "NewValue"); // add a fake column
this.Columns[m_fakeColName].DataType = typeof(List<string>);
}
// fill the cell with different controls based on the cell content before the active cell
private void ultraGrid1_BeforeCellActivate(object sender, IWG.CancelableCellEventArgs e)
if (e.Cell.Column.Key.Equals(m_fakeColName))
string property = e.Cell.Row.Cells[StrProperty].Value.ToString();
if (string.IsNullOrEmpty(property)) return;
if (m_propertyAttriDic[property].CtrlStyle == ControlStyle.CheckedListBox)
Columns[m_fakeColName].Style = IWG.ColumnStyle.DropDownList;
if (cell.EditorComponent == null)
UltraComboEditor editor = new UltraComboEditor();
editor.CheckedListSettings.CheckBoxStyle = Infragistics.Win.CheckStyle.CheckBox;
editor.CheckedListSettings.ItemCheckArea = Infragistics.Win.ItemCheckArea.Item;
editor.CheckedListSettings.EditorValueSource = Infragistics.Win.EditorWithComboValueSource.CheckedItems;
editor.CheckedListSettings.ListSeparator = new string( FilterHelper.Seperators);
editor.ValueList = this.ultraGrid1.DisplayLayout.ValueLists[propertyName];
this.Columns[m_fakeColName].EditorComponent = editor;
private void ultraGrid1_BeforeRowUpdate(object sender, Infragistics.Win.UltraWinGrid.CancelableRowEventArgs e)
List<string> values = e.Row.Cells[m_strFakeValueCol].Value as List<string>;
if (values != null)
string newValue = string.Empty;
foreach (string value in values)
newValue += value;
if (values.IndexOf(value) < values.Count - 1)
newValue += new string(FilterHelper.Seperators);
m_filterList[e.Row.Index].Value = newValue;
private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
string value = e.Row.Cells[StrValue].Value as string;
if (!string.IsNullOrEmpty(value))
e.Row.Cells[m_strFakeValueCol].Value = new List<string>(value.Split(FilterHelper.Seperators));
Thanks in advance.
Regards,
louvie
Is your Save button on the base form? If not, then there is no way to handle this on a base form. If so, then all you have to do is find the form and call ValidateChildren on it.
Thanks for your reply.
In my application, i have lot of forms and i need to implement in on all forms.
We have base form and we inherits all forms from the base form.
So can you suggest me some idea on base form level with some sample code please?
Yes, I understand. So once again, when you click your save button, you can call the IsItemInList method to determine if the item is on the list.
Another option would be to call the ValidateChildren method of the form to force validation of the control(s) without losing focus.
Here in my code i am doing like this.
Private Sub ucCombo_ItemNotInList(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinEditors.ValidationErrorEventArgs) Handles cmbAssignTo.ItemNotInList
Dim ucCombo As Infragistics.Win.UltraWinGrid.UltraCombo = CType(sender, Infragistics.Win.UltraWinGrid.UltraCombo)
Try
ucCombo.Text =""
e.RetainFocus =False
Catch ex As Exception
End Try
But this works only i lost the focus. if focus is still on combo and trying to save will throw an exception.
End Sub
You can't call an event. You can call the IsItemInList method.