How to?

4 Apr 20182 minutes to read

Render SplitButton from Code behind

SplitButton can be rendered from the code behind by initializing the required properties in controller and passing those properties via ViewData or Model to the client side.

The following code illustrates the initialization of SplitButton properties in the controller.

  • C#
  • <ul id="target">
    //Namespace to get the JavaScript (SplitButton) component properties
    using Syncfusion.JavaScript.Models;
    namespace MvcApplication.Controllers
        public class SplitButtonController : Controller
            // GET: SplitButton
            public ActionResult SplitButtonFeatures()
                //Initializing the SplitButton model
                SplitButtonProperties BtnObj = new SplitButtonProperties();
                //Initializing the datasource and other properties
                BtnObj.Text = "login";
                BtnObj.Size= ButtonSize.Medium;
                BtnObj.TargetID = "target";
                //Passing SplitButton properties using the ViewData
                ViewData["BtnModel"] = BtnObj;
                return View();

    Binding the SplitButton properties passed via ViewData from the controller in the client side as below.

  • @{