Loading...
Loading...
Provides complete guidance for implementing the Syncfusion ASP.NET Core Switch (Toggle Switch Button), SplitButton component using Tag Helper. Use this when adding a toggle switch, on/off control, or binary state input to an ASP.NET Core application. This skill covers checked/disabled state, label customization (onLabel/offLabel), RTL support, form integration, BeforeChange event handling, and custom appearance.
npx skill4agent add syncfusion/aspnetcore-ui-components-skills syncfusion-aspnetcore-buttonsSyncfusion.EJ2.AspNet.Core_ViewImports.cshtml<ejs-scripts>onLabeloffLabelcheckeddisabledcssClass="e-small"enableRtlnamevaluecheckedenablePersistencelocaleBeforeChangeChangeCreatedcssClassrolearia-disabledcheckedcssClassdisabledenablePersistenceenableRtlhtmlAttributeslocalenameoffLabelonLabelvaluebeforeChangechangecreated@* _ViewImports.cshtml must have: @addTagHelper *, Syncfusion.EJ2 *@
<ejs-switch id="default"></ejs-switch><ejs-switch id="switch1" onLabel="ON" offLabel="OFF" checked="true"></ejs-switch><ejs-switch id="switch1" disabled="true"></ejs-switch><ejs-switch id="switch1" cssClass="e-small"></ejs-switch><ejs-switch id="switch1" enableRtl="true"></ejs-switch><ejs-switch id="switch1" BeforeChange="onBeforeChange"></ejs-switch>
<script>
function onBeforeChange(args) {
args.cancel = true; // Prevents toggle
}
</script><form>
<ejs-switch id="switch1" name="wifi" value="on" checked="true"></ejs-switch>
<ejs-button id="submit" content="Submit"></ejs-button>
</form>contentitemsViewBag.itemsiconCssiconPositioncssClass="e-vertical"separator: true.e-dropdown-btn.e-split-btntexticonCssseparatoridurldisabledbeforeItemRendertargettargetdisabledenableRtlselectbeforeItemRenderclickselectbeforeOpenopenclosebeforeClosebeforeItemRendercreatedrolearia-haspopuparia-expandedaria-ownsaria-disabledtoggledestroypublic ActionResult Index()
{
List<object> items = new List<object>();
items.Add(new { text = "Cut" });
items.Add(new { text = "Copy" });
items.Add(new { text = "Paste" });
ViewBag.items = items;
return View();
}<ejs-splitbutton id="element" content="Paste" items="ViewBag.items"></ejs-splitbutton><ejs-splitbutton id="element" content="Paste" items="ViewBag.items"
iconCss="e-icons e-paste"></ejs-splitbutton><ejs-splitbutton id="element" content="Paste" items="ViewBag.items"
iconCss="e-icons e-paste" iconPosition="Top"
cssClass="e-vertical"></ejs-splitbutton><ejs-splitbutton id="element" content="Paste" items="ViewBag.items"
disabled="true"></ejs-splitbutton><ejs-splitbutton id="rtl" content="Message" items="ViewBag.items"
enableRtl="true"></ejs-splitbutton><ejs-splitbutton id="element" content="Paste" items="ViewBag.items"
click="onPrimaryClick" select="onItemSelect"></ejs-splitbutton>
<script>
function onPrimaryClick(args) {
// Primary button clicked
}
function onItemSelect(args) {
// args.item contains the selected popup item
console.log(args.item.text);
}
</script>