Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • ASP.NET MVC HTML Helpers

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 280
    Comment on it

    We use HTML helpers in a view to render HTML content. An HTML Helper is simply a method that returns a string. The string can represent any type of content that we want to define.

    The ASP.NET MVC framework includes the following set of standard HTML Helpers (following is not a complete list):


    1) BeginForm

    It marks the start of a form and links to the action method that renders the form. The following example shows markup for the BeginForm helper method.

    <% Html.BeginForm() %>
        <!-- Form content goes here -->
    <% Html.EndForm() %>
    


    2) CheckBox:

    Renders a check box.
    The following example shows markup for the CheckBox helper method.

    <%= Html.CheckBox("fileType") %>
    


    3) RadioButton

    Renders a radio button.It takes three parameters: the name of the control group, the option value, and a Boolean value that determines whether the radio button is selected initially. Following is sampe markup

    Select your favorite technology:<br />
    <%= Html.RadioButton("favTech", "DotNET", true) %> DotNET <br />
    <%= Html.RadioButton("favTech", "Java", false)%> Java<br />
    <%= Html.RadioButton("favTech", "PHP", false)%> PHP <br />
    


    4) TextBox

    Renders a text box.
    The following example shows markup for the text box helper method.

    Enter file name: <%= Html.TextBox("fileName") %>
    


    5) ActionLink

    Links to an action method.
    The following example shows markup for the ActionLink helper method.

    <%= Html.ActionLink("About this Website", "About" ) %>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: