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
290
Cell not formatting with editor
posted

In the rowinitialize event I found some code that you wrote to format a cell a certain way depending on it's value.  It doesn't seem to change the format no matter what I do.  I've set the useeditormasksettings to true but I'm not sure if that is applicable because I'm settign the format, not the mask.

e.Row.Cells["deriv_IV00102QtyOnHandStartLoc"].Column.UseEditorMaskSettings = true;

When I put in the line below setting it to a currency it works which means I'm not setting the format anywhere else by accident

e.Row.Cells["deriv_IV00102QtyOnHandStartLoc"].Column.Format = "c";

When I try the code you put up (i have the MyOwner class in there as well) the field is not formatted at all.

int x = 3;
MyOwner myOwner;
EditorWithText editor;
switch (x)
 {
  case 1:
   myOwner = new MyOwner("d4");
   break;
  case 2:
   myOwner = new MyOwner("e");
   break;
  case 3:
  default:
   myOwner = new MyOwner("c");
   break;
 }
editor = new EditorWithText(myOwner);
e.Row.Cells["deriv_IV00102QtyOnHandStartLoc"].Editor = editor;

Then in another class file I have:

    public class MyOwner : Infragistics.Win.UltraWinEditors.DefaultEditorOwner
    {
        private string format;
        public MyOwner(string format)
        {
            this.format = format;
        }

        public override void GetFormatInfo(object ownerContext, out string format, out IFormatProvider provider)
        {
            base.GetFormatInfo(ownerContext, out format, out provider);
            format = this.format;
        }
    }

What am I missing so that the format of the cell is a certain way when the user is viewing the grid (not editing - I've got editing to work)? 

Once I get this working what I will do next is change each individual value's decimal places depending on what the user has said the particular item's decimal places should show.

  • 290
    Verified Answer
    Offline posted

    Sorry,  you can ignore this issue.  I am using Ideablade to build the grid and in their control configuration I had it set as a numeric editor and it needed to be a editmask editor.