Click or drag to resize

HTMLToolbar Method

Generate HTML code for Toolbar with Bootstrap style. Button type supported Submit, MVC action and Toggle.

Namespace:  SOWIWeb.Helper
Assembly:  SOWIWeb.Helper (in SOWIWeb.Helper.dll) Version: 19.1.23.1 (19.1.23.622)
Syntax
public static string Toolbar(
	List<ToolbarButton> pButtons
)

Parameters

pButtons
Type: System.Collections.GenericListToolbarButton
list of ToolbarButton/>

Return Value

Type: String

[Missing <returns> documentation for "M:SOWIWeb.Helper.HTML.Toolbar(System.Collections.Generic.List{SOWIWeb.Helper.ToolbarButton})"]

Remarks
HTML code example
<button type="submit" name="submit" class="btn btn-default" value="save"><span class="glyphicon glyphicon-ok-sign"></span></button>
<button type="submit" name="submit" class="btn" value="cancel"><span class="glyphicon glyphicon-remove-sign"></span></button>
Examples
This example controls a responsive view. Control the label visibility of button with CSS style. Label is hidden when display size a smartphone (bootstrag xs). Toolbar list for mobile device (isMobileDevice) or for desktop.
/// <summary>
/// Gives toolbar for easyPlan Objekt view
/// </summary>
private List<SOWIWeb.Helper.ToolbarButton> ObjektGetToolbar()
{
    char lQuote = (char)34;
    var lToolbar = new List<SOWIWeb.Helper.ToolbarButton>();

    lToolbar.Add(new SOWIWeb.Helper.ToolbarButton(SOWIWeb.Helper.ButtonType.Submit)
    {
        SubmitValue = easyPlanHelper.ToolbarButtonsObjekt.Calc.ToString(),
        Icon = "glyphicon glyphicon-repeat",
        Label = @"<span class=" + lQuote + "hidden-xs" + lQuote + ">Berechnung</span>" //,
        //TooltipText = @"Berechnung"
    });
    lToolbar.Add(new SOWIWeb.Helper.ToolbarButton(SOWIWeb.Helper.ButtonType.Submit)
    {
        SubmitValue = easyPlanHelper.ToolbarButtonsObjekt.Report.ToString(),
        Icon = "glyphicon glyphicon-file",
        Label = @"<span class=" + lQuote + "hidden-xs" + lQuote + ">Report</span>"
    });
    lToolbar.Add(new SOWIWeb.Helper.ToolbarButton(SOWIWeb.Helper.ButtonType.Event)
    {
        EventHandler = "onclick",
        EventCommand = "window.print()",
        Icon = "glyphicon glyphicon-print",
        Label = @"<span class=" + lQuote + "hidden-xs" + lQuote + ">Drucken</span>"
    });
    lToolbar.Add(new SOWIWeb.Helper.ToolbarButton(SOWIWeb.Helper.ButtonType.Toggle)
    {
        ToggleTarget = "easyPlanObjektShow",
        ToggleType = SOWIWeb.Helper.ToggleType.collapse,
        Icon = "glyphicon glyphicon-collapse-down",
        Label = @"<span class=" + lQuote + "hidden-xs" + lQuote + ">Öffnen</span>",
        Style = SOWIWeb.Helper.HTML.StyleButton + " easyPlanObjektShow"
    });
    lToolbar.Add(new SOWIWeb.Helper.ToolbarButton(SOWIWeb.Helper.ButtonType.Toggle)
    {
        ToggleTarget = "easyPlanObjektHide",
        ToggleType = SOWIWeb.Helper.ToggleType.collapse,
        Icon = "glyphicon glyphicon-collapse-up",
        Label = @"<span class=" + lQuote + "hidden-xs" + lQuote + ">Schliessen</span>",
        Style = SOWIWeb.Helper.HTML.StyleButton + " easyPlanObjektHide"
    });

    //* Import and Export can't mobile *
    if (!this.Request.Browser.IsMobileDevice)
    {
        lToolbar.Add(new SOWIWeb.Helper.ToolbarButton(SOWIWeb.Helper.ButtonType.Toggle)
        {
            ToggleTarget = easyPlanHelper.ToolbarButtonsObjekt.Import.ToString(),
            ToggleType = SOWIWeb.Helper.ToggleType.modal,
            Icon = "glyphicon glyphicon-import",
            Label = @"<span class=" + lQuote + "hidden-xs" + lQuote + ">Import</span>"

        });
        lToolbar.Add(new SOWIWeb.Helper.ToolbarButton(SOWIWeb.Helper.ButtonType.Submit)
        {
            SubmitValue = easyPlanHelper.ToolbarButtonsObjekt.Export.ToString(),
            Icon = "glyphicon glyphicon-export",
            Label = @"<span class=" + lQuote + "hidden-xs" + lQuote + ">Export</span>"
        });
    }

    return lToolbar;
}
See Also