0

Is it possible to set the mask of a devextreme textbox field to a model's property? As in bind the mask property to a model's property value?

For example:

Model:

public MyClass{ 
public string PhoneNumber{get; set;}
public string PhoneMask{get; set; } = "+1 (999) 000-0000"; 
}

View: 
@(Html.DevExtreme().TextBox()
//                    .Mask("+1 (X00) 000-0000")
                    .Mask(Model.PhoneMask)
                    .Value(Model.PhoneNumber)
                    .InputAttr("aria-label", "Mask")
                    
                )

1 Answer 1

0

Yes, it is possible. It appears that you already do something similar. Make sure that you pass a correct Model (with the initialized / expected PhoneMask property value). Check out how the TextBox().Mask() builder method works at https://demos.devexpress.com/ASPNetCore/Demo/TextBox/Overview/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.