Home > DeveloperSection > Forums > What is the difference between “HTML.TextBox” vs “HTML.TextBoxFor”?
Anupam Mishra

Total Post:135

Points:949
Posted on    February-04-2016 10:15 PM

 ASP.Net C#  ASP.Net  ASP.NET MVC 
Ratings:


 1 Reply(s)
 314  View(s)
Rate this:
Hi Everyone,
I am using  ASP.NET MVC4 and defining a text box using HTML.TextBox html helper class .But i want to know what is difference between “HTML.TextBox” and “HTML.TextBoxFor”. Please give me a solution.

Thank you.


Anupam Mishra

Total Post:135

Points:949
Posted on    February-04-2016 10:37 PM

“HTML.TextBox” vs “HTML.TextBoxFor” both are  give the same output. “HTML.TextBoxFor” is strongly typed while “HTML.TextBox” isn’t.
Html.TextBox("StudentCode")
Here ,  “Html.TextBoxFor” code which creates HTML textbox using the property name ‘StudentCode” from object “m”.
Html.TextBoxFor(m => m.StudentCode)


Modified On Feb-04-2016 10:38:57 PM

Don't want to miss updates? Please click the below button!

Follow MindStick