Hi everyone,
I am using radGrid to exibit information of people! one of the fields is Mobile that is thought to be Numeric and limited digits. So I am using GridviewMaskboxColumn by following code :
GridViewMaskBoxColumn mobileColumn = new GridViewMaskBoxColumn();
mobileColumn.HeaderText = "Mobile#";
mobileColumn.MaxLength = 10;
mobileColumn.FieldName = "MobileNo";
mobileColumn.MaskType = MaskType.Numeric;
mobileColumn.Mask = "G";
grid.Columns.RemoveAt(10);
grid.MasterTemplate.Columns.Insert(10, mobileColumn);
Everything's fine but The Maxlength doesn't work! I mean when you want to edit MobileNo, you can enter digits more than 10!
Any ideas?!
Thanks
I am using radGrid to exibit information of people! one of the fields is Mobile that is thought to be Numeric and limited digits. So I am using GridviewMaskboxColumn by following code :
GridViewMaskBoxColumn mobileColumn = new GridViewMaskBoxColumn();
mobileColumn.HeaderText = "Mobile#";
mobileColumn.MaxLength = 10;
mobileColumn.FieldName = "MobileNo";
mobileColumn.MaskType = MaskType.Numeric;
mobileColumn.Mask = "G";
grid.Columns.RemoveAt(10);
grid.MasterTemplate.Columns.Insert(10, mobileColumn);
Everything's fine but The Maxlength doesn't work! I mean when you want to edit MobileNo, you can enter digits more than 10!
Any ideas?!
Thanks
6 Answers, 1 is accepted
0
Hi Majid,
Thank you for writing.
The MaxLength property is valid only for MaskType None. For other types of masks (Numeric for example), the Mask property has higher priority than MaxLength - for example mask "n3" means unlimited digits before decimal separator and 3 digits after it; "g" mean unlimited numbers.
the Telerik team
Thank you for writing.
The MaxLength property is valid only for MaskType None. For other types of masks (Numeric for example), the Mask property has higher priority than MaxLength - for example mask "n3" means unlimited digits before decimal separator and 3 digits after it; "g" mean unlimited numbers.
Do not hesitate to contact us if you have other questions.
All the best,
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Majid
Top achievements
Rank 1
answered on 12 Apr 2012, 04:46 PM
Hi Peter and thanks for reply
Let me tell you what I need for this field.
As I mentioned above, I have a mobile field which has to be numeric and limited to 10 digits. Plus, I don't want to have separator between digits. How can I handle it?!
Thanks
Let me tell you what I need for this field.
As I mentioned above, I have a mobile field which has to be numeric and limited to 10 digits. Plus, I don't want to have separator between digits. How can I handle it?!
Thanks
0
Accepted
Don
Top achievements
Rank 1
answered on 12 Apr 2012, 05:12 PM
If it is up to 10 digits you can use a mask of 9999999999, which should make all of the digits optional. If you need at least some of the digits to be entered just replace some of the 9s with 0s (zeroes). The 0 makes the digit mandatory. I believe this would work as either a numeric or standard mask.
0
Majid
Top achievements
Rank 1
answered on 12 Apr 2012, 07:17 PM
Hi Don
Thanks for your solution!
That works pretty well
Thanks for your solution!
That works pretty well
0
Don
Top achievements
Rank 1
answered on 12 Apr 2012, 07:28 PM
Glad to hear it, Majid! :-)
0
Hi Don,
Thank for sharing your experience with the community.
Peter
the Telerik team
Thank for sharing your experience with the community.
I updated your Telerik point for the community effort.
Greetings,Peter
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>