Getting Started with EJ 1 ASP.NET MVC ToggleButton

10 Jul 2017 / 1 minute to read

This section explains briefly about how to create a ToggleButton in your ASP.NET MVC application.

Create your first Toggle Button in MVC

The Toggle Button control displays both text and images. The text displayed on the Toggle Button is contained in the Text property. The Toggle Button control display images using the SpriteCssClass and ImagePosition properties. The Toggle Buttons has theme support also.

The following screenshot illustrates a Toggle Button control.

Getting-Started_img1

Toggle Button in OFF state_

Getting-Started_img2

Toggle Button in ON state

Create a Toggle Button

Essential Studio ASP.NET MVC Toggle Button control has a built-in feature to customize the size, text and images of button.

  1. Create an MVC Project and add required assemblies, scripts, and styles to it. Refer MVC-Getting Started Documentation.
  2. Add the following code example to the corresponding view page to render the Toggle Button.

     @Html.EJ().ToggleButton("button").Size(ButtonSize.Mini).ShowRoundedCorner(true).DefaultText("Play")
  3. Output of the above steps.

Getting-Started_img3