HTML and CSS Reference
In-Depth Information
Figure 3-16. Selecting the project(s) to update
once the install has completed, close the Manage nuGet Packages dialog box.
You should now see quite a few templates in the EditorTemplates folder. open the
EmailAddress.cshtml file. The third-party implementation for this template is shown
in listing 3-8. While this is implemented differently from yours, it accomplishes
basically the same thing, including getting the placeholder from the metadata.
Listing 3-8 . The open source Email template
var attributes = new Dictionary<string, object>();
attributes.Add("type", "email");
attributes.Add("class", "text-box single-line");
attributes.Add("placeholder", ViewData.ModelMetadata.Watermark);
//since this is a constraint, IsRequired and other constraints
//won't necessarily apply in the browser, but in case script
//turns off readonly we want the constraints passed
if (ViewData.ModelMetadata.IsReadOnly)
Search WWH ::

Custom Search