Hi Guys
I am beginner in ASP.NET MVC4 and defining a text box using HTML.TextBox html helper class .But i want to know that what is difference between “HTML.TextBox” and “HTML.TextBoxFor”. Please help me.
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rajeesh MenothRank #118 · 18.4K reputationPosted Jun 3, 2016, 12:57 AM EDT
Munesh SharmaRank #174 · 13.9K reputationPosted Jun 3, 2016, 1:43 AM EDT
Ultimately they both produce the same HTML but Html.TextBoxFor() is strongly typed where asHtml.TextBox isn't.
1: @Html.TextBox("Name")
2: Html.TextBoxFor(m => m.Name)
will both produce
So what does that mean in terms of use?
Generally two things:
Zack Mathews7 reputationPosted Jun 4, 2016, 12:53 AM EDT
Vinitha TRank #8,005 · 230 reputationPosted Oct 29, 2021, 7:53 AM EDT