IP Address for Mask Textbox

4 posts, 0 answers
  1. Gourangi
    Gourangi avatar
    83 posts
    Member since:
    Mar 2008

    Posted 05 Feb 2009 Link to this post

    Hi,

    I wanted to set IP Address for mask editor.

    I have set value 000.000.000.000 to property mask of my control.

    Now when I assign value 192.168.42.117, it accepts as 192.168.421.17_
    It should be 192.168._42.117 or 192.168.42_.117

    Another thing I found strange is I assign .Text property a particular value, after that I call .focus() method of that control and it removes the assigned value !

    Like
    maskControl.Text="192.168._42.117";
    maskControl.Focus();
    Now the value given i.e. "192.168._42.117" is gone !

    Regards,
    Divyesh Chapaneri
  2. Boyko Markov
    Admin
    Boyko Markov avatar
    610 posts

    Posted 06 Feb 2009 Link to this post

    Hello Divyesh Chapaneri,

    You can set the value and mask properties like the following:

        this.radMaskedEditBox1.Mask = "000.000.000.000";
        this.radMaskedEditBox1.Value = "192168042117";

    The result of there settings will be:
        192.168.042.117

    This is the best case I can provide you with our control. However we have plans in the future to implement more complex validation and mask handling in RadMaskedEditBox. The behavior will include Regular expressions and built in validation. One of the built in features in the control will be IP mask type.

    Also if the mask is set to "000.000.000.000" the behavior you have encountered is expected. The "0's in the mask represent digit characters. A placeholder such as "_" is drawn when there are no digit characters.

    Regarding assigning text, you need to use the control's Value property instead of the Text property.

    Text property is updated with the Value property so if there is no Value and you call Focus the control will update itself and set the Text corresponding to the empty Value.

    Best wishes,
    Boyko Markov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Mehdi Mirza
    Mehdi Mirza avatar
    11 posts
    Member since:
    Apr 2009

    Posted 27 Apr 2009 Link to this post

    Hi Boyko,

    Regarding using the edittextbox for ip address with mask 000.000.000.000

    Here the problem is if we have a ip 65.65.5.15 the user needs to enter 065.065.005.015, this is a pain for users who are used to typing only the ip numbers without the zero. Also the "_" gets saved as text when trying to save the text from textbox.
    There is another issue as pressing a "." does not take you to the next space to enter ip address.

    Is there a way where we dont have to enter the 0 for ip address if its only two digit?


    Thanks

    Mehdi
  5. Boyko Markov
    Admin
    Boyko Markov avatar
    610 posts

    Posted 30 Apr 2009 Link to this post

    Hello Mehdi Mirza,

    We do not support the described features. I agree that the users cannot do a perfect simulation of IP edit box field and they should add "0" when it is needed.  I think that here is needed a custom validation logic which is not supported by default in our control.

    The second issue you describe is very interesting. We will consider this feature implementation for the next versions of the control. I can suggest you try to control( move left or right ) the caret position in the event handlers of KeyDown and KeyUp events and check the Key value whether the "." key is pressed. Here is a sample code how to do this:

         this.radMaskedEditBox2.MaskedEditBoxElement.TextBoxItem.HostedControl.KeyUp += new KeyEventHandler(HostedControl_KeyUp);
          
    Kind regards,
    Boyko Markov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top