@Html.TextBoxFor :- It will always render like an input
textbox irrespective datatype of the property which is getting bind with the
control.
Example:-
@Html.TextBoxFor always create a
textbox (<input
type=”text”>)
@Html.EditorFor :- This Html
helper method is dynamic in nature. It will render HTML markup based on the datatype
of the property.
If you have Boolean property in
Model. To render this property in view as a checkbox.
If you have String property in
Model. To render this property in view as a textbox.
If you have int property in
Model. To render this property in view as a textbox type=”number”.
Example:-
@Html.EditorFor(model => model.Name)
Advantages of @Html.EditorFor:-
No comments:
Post a Comment
Note: only a member of this blog may post a comment.