CS4 webControl25

CS4 webControl25

Button25

Button25 is a flexible and reusable button control designed to handle standard actions, form submissions, navigation, popups, and dropdown action menus. It supports multiple styles, sizes, icons, and behaviors.

Key Features

  • Supports Submit and Button types
  • Multiple predefined button colors
  • Standard and custom width options
  • Left and right alignment
  • Font Awesome icon support
  • URL navigation, new tab, and popup support
  • Dropdown action menus

Constructor

A Button25 instance must be created using the constructor.

var btn = new Button25("btnSave", "Save", "Save");
  
  • ControlId – Unique HTML id and name
  • Name – Button display text
  • Value – Button value attribute

Enums

ButtonType

  • Submit – Submits the form
  • Button – Normal button

ButtonAlign

  • Left – Default alignment
  • Right – Right-aligned button

ButtonColor

  • Green
  • Blue
  • Red
  • Yellow
  • Cyan
  • Grey
  • Black

Size

  • S1 – 100px
  • S2 – 150px
  • S3 – 200px
  • S4 – 250px
  • S5 – 300px
  • S6 – 350px
  • S7 – 400px
  • Max – Full width
  • Auto – Auto width

Properties Object

The Properties class is used to configure the button behavior and appearance.

  • ButtonColor – Button color style
  • ButtonAlign – Left or Right alignment
  • StandardWidth – Predefined width using Size enum
  • CustomWidth – Custom width in pixels
  • ButtonType – Submit or Button
  • OnClick – JavaScript function name
  • FontAwesomeIcon – Icon class name

Sample code

var btn = new Button25("btnSave", "Save", "Save");

var props = new Button25.Properties
{
    ButtonColor = Button25.ButtonColor.Green,
    ButtonType = Button25.ButtonType.Submit,
    FontAwesomeIcon = "fas fa-save"
};

@btn.GetHtml(props)
  

Navigation Buttons

Open URL in Same Tab

btn.AddUrl("/Home/Index");
@btn.GetHtml()
  

Open URL in New Tab

btn.AddUrl("https://example.com", true);
@btn.GetHtml()
  

Open URL as Popup

btn.AddUrl("/Popup/Page", 500, 800);
@btn.GetHtml()
  

Button with JavaScript Action

var btn = new Button25("btnClick", "Click Me", "Click");

var props = new Button25.Properties
{
    ButtonColor = Button25.ButtonColor.Blue,
    OnClick = "myFunction"
};

@btn.GetHtml(props)
  

Dropdown Action Button

Button25 supports dropdown action menus for multiple related actions.

var actions = new List
{
    new Button25.DropdownMenuItem("Edit", "/Edit/1", fontAwesomeIcon: "fas fa-edit"),
    new Button25.DropdownMenuItem("Delete", "", OnClick: "deleteItem(1)")
};

@Button25.GetHtmlForAction("action1", actions)
  

Postback Dropdown Button

var menuItems = new List
{
    new Button25.DropdownMenuItem("Approve", "/Approve/1"),
    new Button25.DropdownMenuItem("Reject", "/Reject/1")
};

@Button25.GetHtmlForPost(menuItems, "Actions", Button25.ButtonColor.Green)