Some cells I need the mask set just for the time and others I need it for the date and the time and others I need it just for the date.
I'm able to set the mask at the column level but not the cell level. I found this other post that seems to be along the same lines, but not sure. Could you provide a code sample?
http://ko.infragistics.com/community/forums/t/17954.aspx
Thanks,
David
Hi David,
What you do is.. for each mask that you need, create a masked editor control. Any of the masked editors would work, but in your case, it makes sense to use a DateTimeEditor since you are dealing with dates.
Then in the InitializeRow event of the grid, set the EditorControl property of the Cell (not the column) to the DateTimeEditor with the appropriate mask.
Since the grid column has properties to control the mask, you also have to tell the column to use the mask from the editor over it's own mask settings. So you need to set UseEditorMaskSettings on the column to true.
Sorry I took so long to get back to you. Had to leave the office for a road trip.
What you supplied is working great, however, I need to get the Wingrid to display what the Editor is. Is there a way to set the mask on the cell as well in this scenario?
Yeah, from the searches I've been doing, I'm only able to set the cell mask at the column level....
e.Layout.Bands[0].Columns["dtBeginBin"].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.OnMouseEnter;e.Layout.Bands[0].Columns["dtBeginBin"].Editor = DateTimeEditor;e.Layout.Bands[0].Columns["dtBeginBin"].MaskInput = "mm/dd/yyyy";e.Layout.Bands[0].Columns["dtBeginBin"].Format = "MM/dd/yyyy";
I just realized that the reason it was showing just the time is because I had not removed the text mask on the column. All is good. Thanks to both of your for your help.
Hello David,
Thank you for your response.
To get the behavior you're looking for, you need to set the FormatString property on the various UltraDateTimeEditor instances as I've done in the attached sample. This property uses the standard .NET string formatting code.
Please let me know if I may be of further assistance.
Please reread what I've written above after reviewing the enclosed screen shot.
Please let me know if the sample project Mike provided earlier has the behavior you're looking for. Also, please provide screenshots so we can get a clearer picture of the issue you're facing.
How do I set a mask on a cell at the initialize row event?