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
    • 553
    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.

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


    2) CheckBox:

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

    1. <%= 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

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


    4) TextBox

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

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


    5) ActionLink

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

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

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: