Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply input which has a type email to to HTML Helper in Asp.net MVC3 Razor

How to apply input which has a type email to HTML Helper in Asp.net MVC3 Razor. For example:

 <input type="email" name="name" value=" " placeholder="[email protected]" />

Is there alternative in Razor?

like image 793
Elvin Mammadov Avatar asked May 22 '13 10:05

Elvin Mammadov


People also ask

How do you add an extension to the HTML helper?

Creating HTML Helpers with Static Methods The easiest way to create a new HTML Helper is to create a static method that returns a string. Imagine, for example, that you decide to create a new HTML Helper that renders an HTML <label> tag. You can use the class in Listing 2 to render a <label> .

What is the difference between HTML helper and tag helpers?

Unlike HtmlHelpers, a tag helper is a class that attaches itself to an HTML-compliant element in a View or Razor Page. The tag helper can, through its properties, add additional attributes to the element that a developer can use to customize the tag's behavior.

How would you use the input tag helper to bind an input element to an expression in a razor view file?

The Input Tag Helper binds an HTML <input> element to a model expression in your razor view. The Input Tag Helper: Generates the id and name HTML attributes for the expression name specified in the asp-for attribute. asp-for="Property1.


1 Answers

You can use Html.TextBox method.

@Html.TextBox("name","", new { type = "email", placeholder = "[email protected]" })
like image 93
Ufuk Hacıoğulları Avatar answered Sep 24 '22 22:09

Ufuk Hacıoğulları