Button types in EJ 1 ASP.NET MVC ToggleButton

4 Mar 2016 / 1 minute to read

Toggle Button is used as normal click able button, submitting form data, resetting the form data to its initial value. According to the usage of button, you can render the Toggle Button in the following three types by using the Type property.

Toggle Button Types

Button The button is a click able button
Submit The button is a submit button (submits form-data)
Reset The button is a reset button (resets the form-data to its initial values)

The following steps explains you the details about rendering the Toggle Button with above mentioned types.

  1. In the View page, add the following button elements to configure Toggle Button widget.
  • cshtml
  • @*Add the code in CSHTML page to configure the widget and initialize the control*@
    
    <div class="one">
    
    	@*set toggle button type using type property*@
    
    	<table>
    
    		<tr>
    
    			<td class="btnsht">
    
    				@Html.EJ().ToggleButton("toggleButton_button").Size(ButtonSize.Mini).ShowRoundedCorner(true).ContentType(ContentType.TextOnly).DefaultText("button").ActiveText("Next").Type(ButtonType.Button)
    
    			</td>
    
    			</tr>
    
    		<tr>
    
    			<td class="btnsht">
    
    				@Html.EJ().ToggleButton("toggleButton_submit").Size(ButtonSize.Mini).ShowRoundedCorner(true).ContentType(ContentType.TextOnly).DefaultText("submit").ActiveText("Next").Type(ButtonType.Submit)
    
    			</td>
    
    			</tr>
    
    		<tr>
    
    			<td class="btnsht">
    
    				@Html.EJ().ToggleButton("toggleButton_reset").Size(ButtonSize.Mini).ShowRoundedCorner(true).ContentType(ContentType.TextOnly).DefaultText("reset").ActiveText("Next").Type(ButtonType.Reset)
    
    			</td>
    
    
    
    		</tr>
    
    	</table>
    
    </div>

    Execute the above code to render the following output.

    Button-types_img1

    Types of Toggle button