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
90
Ultragrid - cell mask and format
posted

 Hi,

 I have a cell that displays a performance value. I need to display it as follows. 60.00% How can i do this. I set the style of column to double and datatype to decimal.

Also when in edit mode i should be able to enter something like 60.00G% or 60.00N% or 60.00 G %,etc... combinations... the G and N are the only alphabets it should accept. The reason for G and N is that based on the alphabet i set the value of another cell.

Can someone let me know how i can do this. Thanks for the help in advance

 Cheers

Rajesh

Parents
  • 37774
    posted

     Rajesh,

    I don't think that there is any support for specifying that only a 'G' or 'N' can be entered within a mask.  One option would be to handle the KeyDown event yourself and prevent it from propogating to the editor, though this would be complicated since you would have to see if the cursor is at the specific portion of the mask.  The other option is to assign a regular expression to the RegexPattern property of the column, though I don't think that this will be checked until the user tries to exit edit mode on the cell.

    An example of a mask that you might use is:

    private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
    {
        UltraGridColumn col = e.Layout.Bands[0].Columns["Col 1"];
        col.MaskInput = "99.9>A%";
        col.MaskDisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeLiterals;
    }

    You can find a list of supported mask characters here.

    -Matt

Reply Children