I'm really sorry if my problem was discussed already. But i did not found an answer.
I have ultragrid which is bound to DataTable. One of the columns should support masked input, this datacolunm is type of string.
Entered data should have format "aaaaa/aa.aaaa", where 'a' is alphanumeric.
Here is short code example.
column.EditorComponent = new UltraMaskedEdit() { InputMask = "aaaaa\\/aa\\.aaaa", DisplayMode = MaskMode.IncludeBoth, ClipMode = MaskMode.IncludeBoth };
When the cell is in edit mode mask is shown. When the cell is not active - data are shown without mask. I've tried to set column.Format to "aaaaa\\/aa\\.aaaa", but unsuccessful.
If I do not set EditorComponent, but use column.MaskInput instead, then data from cell are stored with mask into DataTable.
Setting column.MaskDataMode to MaskMode.Raw has np effect.
Please help me to show my data with mask :)
Hi,
You are making this much more complicated than you need. :)
DisplayMode and ClipMode on the editor will have no effect on the grid column. Also, Format will not work on a String, since the String.ToString method doesn't support any formatting in DotNet.
You don't need an editor or a format for this.
All you need to do is set the properties for the mask directly on the column.
column.MaskInput = "aaaaa\\/aa\\.aaaa"; column.MaskDisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeBoth;
Hi, Mike. Thank you for your answer.
I've tried your code, but it is not suitable for me, because string from cell is stored into my DataTable with mask symbols. Please look for attached figure.
I need raw data in my DataTable (without any /. ). Setting column.MaskDataMode to MaskMode.Raw has no effect.
Mike, thank you for your kind help. The problem was in my code, there was an event OnGridAfterExitEditMode that have corrupted my data. This was my stupid mistake.
Can I ask one more question. I know it is possible to set InputMask on each cell in the column (when mask depends on another cell value, for example). I've found disscussion how to do this using EditorComponent of the cell.
But in this case mask is not shown when the cell is not in edit mode. Can you help me?
If you are applying the mask to a cell via an editor or EditorComponent (which is what you would have to do in order to apply a mask to a cell and not a column), then you must set the UseEditorMaskSettings property on the column to true. This tells the cells in that column to ignore the column's mask properties like MaskDisplayMode and use the editor's MaskDisplayMode instead.
I am using UltraGrid in my application.
That grid contains only one column called value.
Depeneidng on some criteria , in run time i am setting editor component of the column value.
When i m setting it to DateTime havin mask input, format string evey thing set as
FormatString =
"dd/MM/yyyy hh:mm:ss",
MaskInput =
"dd/mm/yyyy hh:mm:ss".
When i am running the application, second section of time is not appearing in the grid cell also its not allowing me to enter more than 12 number i.e. if i try to enter 13 or more than that it's not allowing me to do that.
Please let me know in case some thing specific needs to be done for getting both the above mentioned point done.
Request you to reply at the earliest.
Below is the code snippet for the same which i have written:
var
editorColumn = _controlSelectedValues.DisplayLayout.Bands[0].Columns["Value"];
editorColumn.EditorComponent =
new UltraDateTimeEditor
{
FormatProvider =
new System.Globalization.CultureInfo("fr-FR"),
"dd/mm/yyyy hh:mm:ss",
Name =
"udteMaxDateValue",
Tag =
"Removable Control",
NullText =
"Select end date",
TabIndex = 8,
Value =
null
};
I tried out your code and it works fine for me. I have attached my sample here so you can try it out.
You need to use the EditorButtonClick event on the UltraTextEditor, not the click event of the button.
The e.Context parameter in the event will give you the cell for which the button was clicked.
Hi Mike ..
As i am new to this Infragistic, so biothering you repeateadly.. Sorry for the same.
Facing new issue with UltraGrid.
Steps:
Run Time i added one more column to one grid.
created one UltraTExtEditorControl with button left on it and assigned the previously added column editor component as UltraText Editor.
Now whole cell for that column is appearing as UltraTextEditor with button but click event of that button is not getting fired.
Please let me know the if im missing some step.
Thanks..
Hi Mike..
The problem has been solved by using DataSourceUpdateMode to OnValidation.
However i am still trying to understand why that problem was coming i was using DataSourceUpdateMode to OnPropertyChanged while binding property with it.
Thanks,
Rajeev Ranjan
Hi Mike.
I am facing very strange problem in my current application.
I am showing one form as modal window .In that window, at run time i m adding DateTime editor control and code for the mentioned points is like :
private
Control[] SetTheDateTimeBasedControl()
//Minimum date value control...
var udteMinDateValue = new UltraDateTimeEditor
Location = _minLoc,
"udteMinDateValue",
"Select begin date",
Size = _size,
TabIndex = 7,
//Maximum Date based control..
var udteMaxDateValue = new UltraDateTimeEditor
Location = _maxLoc,
//Adding control to the list..
_controlList.Add(udteMinDateValue);
_controlList.Add(udteMaxDateValue);
return _controlList.ToArray();
}
For only date data type
same as above except
"dd/mm/yyyy",
...
When i am running my application, not able to change year part in case of date Data Type.
In case DateTime Data Type not able to enter hh mm and sec more than 02..
Not able to find what can be the possible cause..
Please reply me at the earliest...
The only thing was missing in my code was UseEditorMask property of the column which i needed to set to true.
Sorry for the late update.
Thanks a lot for your concern.