First I would check if the _PhoneNumFormatter
is defined in one of the following locations:
~/Views/Shared/DisplayTemplates/_PhoneNumFormatter.cshtml
~/Views/<Controller>/DisplayTemplates/_PhoneNumFormatter.cshtml
Next I think you wanted to format the string value directly from the Model
property:
@model String
@if (!String.IsNullOrWhiteSpace(Model))
{
@String.Format("{0: (###) ###-####}", Convert.ToInt64(Model))
}
This should work fine with the UIHint
attribute, I've just checked in a sample application.
Code assumes that numbers in your region don't start with a leading 0 and that the Model
property will contain strings containing only numeric characters, if not you should improve the Convert.ToInt64
part.
Hope it helps.