This is a migrated thread and some comments may be shown as answers.

GridViewMaskBoxColumn and standart mask.

2 Answers 127 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jose Mejia
Top achievements
Rank 1
Jose Mejia asked on 11 Jul 2013, 12:21 PM
Hi.

For now I'm using GridViewMaskBoxColumn with standart mask type and 00°00'00.00000'' as a mask.
I also changed promt char to 0:
private void CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
 {
  RadMaskedEditBoxEditor editor = e.ActiveEditor as RadMaskedEditBoxEditor;
  if (editor != null)
  {
      editor.MaskTextBox.PromptChar = '0';
           
  }
 
...
}


The requirements has changed and now I need to show + or -  before the mask so it should look like
+00°00'00.00000''. The most easiest way is to use #00°00'00.00000'', but in this case when I start edit
masktextbox looks like 000°00'00.00000'' which is very inconvenient. So I need some how to provide possibility to let use enter (choose)
+ or - and preserve the old mask (00°00'00.00000''). The regex is also not very convenient.

Is the any possibility to provide selection of a sign for standart mask?

My control version is 2011.2.11.831

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Jose Mejia
Top achievements
Rank 1
answered on 11 Jul 2013, 04:08 PM
Ok, I somehow solved this problem.This thread can be closed...
0
Peter
Telerik team
answered on 12 Jul 2013, 04:39 AM
Hello Jose,

I am happy that you found a solution for this.

I would like to propose to use "#00°00'00.00000" mask and handle the RadMaskEditBox's KeyPress event if user enters a number in the first position:
editor.MaskedEditBox.KeyPress
-= 
new KeyPressEventHandler(MaskedEditBoxElement_KeyPress);

editor.MaskedEditBox.KeyPress
+=
new KeyPressEventHandler(MaskedEditBoxElement_KeyPress);
 
void MaskedEditBoxElement_KeyPress(object sender, KeyPressEventArgs e)
{
         if (char.IsDigit(e.KeyChar) && this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.SelectionStart == 0)
         {
              e.Handled = true;
         }
}

I hope you find this useful.

Regards,
Peter
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Jose Mejia
Top achievements
Rank 1
Answers by
Jose Mejia
Top achievements
Rank 1
Peter
Telerik team
Share this question
or