Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Checkbox column for enumerator type column.
posted

Hi,

 I am trying to use a datafilter to convert an enumerator to checkbox states. What I am doing is very similar to the issue treated in this article:

http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=5014

 The problem is that when I try to assign a UltraCheckEditor to the column or setting the style to CheckBox then I get the message that the UltraCheckEditor cannot be assigned to the value type of the column. The datafilter is translating the values to checkstate and when I check the result in the grid the checkstate checked or unchecked are displayed. But I can still not set the control to a checkbox control.

 In the inizializelayout function I do this:

column.EditorControl = new UltraCheckEditor();

And in the datafilters convert method I do the following:

switch (args.Direction)

 {

 case ConversionDirection.EditorToOwner:

 args.Handled = true;

 CheckState state = (CheckState)args.Value;

 switch (state)

 {

 case CheckState.Checked:

 return ConfirmationStatus.CONFIRMATIONCOMPLETE;

 case CheckState.Indeterminate:

 return ConfirmationStatus.CONFIRMATIONINPROCESS;

 case CheckState.Unchecked:

 return ConfirmationStatus.NOTCONFIRMED;

 }

 break;

 case ConversionDirection.OwnerToEditor:

 args.Handled = true;

 if ((ConfirmationStatus)args.Value == ConfirmationStatus.CONFIRMATIONCOMPLETE)

 {

 return CheckState.Checked;

 }

 else if ((ConfirmationStatus)args.Value == ConfirmationStatus.CONFIRMATIONINPROCESS)

 {

 return CheckState.Indeterminate;

 }

 else if ((ConfirmationStatus)args.Value == ConfirmationStatus.NOTCONFIRMED)

 {

 return CheckState.Unchecked;

 }

 break;

 }

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    Hi,

        It sounds to me like you are assigning the DataFilter after you assign the Editor to the column. You need to assign the DataFilter to the editor before you assign the editor to the grid column.

        Also... this has nothing to do with the problem, but this code is not such a good idea: 

    column.EditorControl = new UltraCheckEditor();

         Basically, you are creating a new control here that is not contained in the form's controls collection. This control will not get disposed when the form does, so this could create a memory leak. If you are going to create a control, you should make sure to add it to the Control collection of the form. In this case, however, you really don't even need a control. You would be better off using an editor. So the code should look something like this: 

    CheckEditor checkEditor = new CheckEditor();
    checkEditor.DataFilter = myDataFilter;
    column.Editor = checkEditor;

Children
No Data