Text box in ASP.NET MVC view in ASP.NET MVC

How to create a text box in the ASP.NET MVC view?

To create a textbox, use @Html.TextBox helper method. 
@Html.TextBox("FirstName", "Value Optional") 
If the view is using Model and we need to create a textbox corresponding to the Model property, we can use @Html.TextBoxFor helper method
@Html.TextBoxFor(model => model.FirstName) 
Or 
@Html.EditorFor(model => model.FirstName) 
The difference between @Html.TextBoxFor and @Html.EditorFor are following 


No comments:

Post a Comment

How to register multiple implementations of the same interface in Asp.Net Core?

 Problem: I have services that are derived from the same interface. public interface IService { } public class ServiceA : IService { ...