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?
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.
Hi,
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.
How do I set a mask on a cell at the initialize row event?
Hello David,
Thank you for your response.
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.
Please let me know if I may be of further assistance.
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.
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 reread what I've written above after reviewing the enclosed screen shot.