HOW TO USE HTML HELPERS IN MVC?

Anupam Mishra

Total Post:135

Points:949
Posted by  Anupam Mishra
 546  View(s)
Ratings:
Rate this:
Hi Everyone,
I am working on ASP.NET MVC4 framework and i want to use HTML helpers for render HTML controls in the view.
Please can anyone give me a solution.
Thank you.
  1. Anupam Mishra

    Post:135

    Points:949
    Re: How to use HTML helpers in MVC?

     We use use HTML helpers for render HTML controls in the view. In this example we will use “HTML.TextBoxFor” is strongly typed while “HTML.TextBox” isn’t. Below is a simple HTML code which just creates a simple textbox with “StudentCode” as name.

    Html.TextBox("StudentName")
    Below is “Html.TextBoxFor” code which creates HTML textbox using the property name ‘StudentCode” from object “m”.

    Html.TextBoxFor(m => m.StudentName)
    In the same way we have for other HTML controls like for checkbox we have “Html.CheckBox” and “Html.CheckBoxFor”.   

      Modified On Apr-11-2018 01:20:12 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!