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";
Hi,
I'm confused. What part of my solution isn't working for you?
You need to set the editor on the Cell, not the column. The InitializeRow event is typically a good place to do this.
e.Row.Cells[dtBeginBin"].EditorControl = myEditorWithTheMaskSettingsIWant;
What you gave me worked perfect. The problem now is that the cell isn't displaying the result that was captured by the editor.
Thank you for following up on this. Not sure how to force it to be the same.
I'm confused. What do you mean "captured by the editor?"
You are saying that my sample works perfectly and then you appear to be asking how to do exactly what the sample already does.
You don't set the mask on the cell. What you do is you set the editor of that cell to a control that supplies the mask you want. That's what my sample does.
When I'm done editing a cell, the editor goes away and the cell reveals it's contents with whatever mask is on the cell.
I need have the cell show the same results as the editor.
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?