Search results

Template

In Dialog the template support is provided to the header and footer sections. So any text or HTML content can be appending in these sections.

The Dialog header content can be provided through the header property, and it will allow both text and any HTML content as a string. Also in header, close button is provided as built-in support, and this can be enabled through the showCloseIcon property.

The Dialog footer can be enabled by adding built-in buttons or providing any HTML string through the footerTemplate.

The buttons and footerTemplate properties can’t be used at the same time.

The below example demonstrates the usage of header and footer template in the Dialog

razor
Footer.cs
@section ControlsSection{

<div id="target" class="col-lg-12 control-section" style="height:100%">
        @Html.EJS().Button("targetButton").Content("OPEN DIALOG").Render()
        @Html.EJS().Dialog("dialog").Created("onLoad").Open("dialogOpen").Close("dialogClose").Header("<img class='img2' src='./../Content/Dialog/images/1.png' alt='header image'><div title='Virtualization Dialog' class='e-icon-settings e-icons' style='padding: 3px; '>Nancy</div>").FooterTemplate("<input id='inVal' class='e-input' type='text' placeholder='Enter your message here!'><button id='sendButton' class='e-control e-btn e-primary' data-ripple='true'>Send</button>").ShowCloseIcon(true).CloseOnEscape(false).Width("45%").Target("#target").Height("85%").ContentTemplate(@<div class='dialogContent'><span class='dialogText'>Greetings Nancy! When will you share me the source files of the project?</span></div>).Render()
    </div>
    
}

<script>

    var validText;
    function onLoad() {
        document.getElementById('targetButton').onclick = function () {
            var dialogObj = document.getElementById('dialog').ej2_instances[0];
            dialogObj.show();
        };
        (document.getElementById('inVal')).onkeydown = function (e) {
            if (e.keyCode === 13 && validText != "") {
                updateTextValue();
            }
        };
        (document.getElementById('sendButton')).onkeydown = function (e) {
            if (e.keyCode === 13 && validText != "") {
                updateTextValue();
            }
        };
        document.getElementById('sendButton').onclick = function (e) {
            updateTextValue();
        }
    }
    function updateTextValue() {
        var enteredVal = document.getElementById('inVal');
        var dialogTextElement = document.getElementsByClassName('dialogText')[0];
        var dialogTextWrap = document.getElementsByClassName('dialogContent')[0]; 
        if (enteredVal.value !== '') {
            dialogTextElement.innerHTML = enteredVal.value;
            enteredVal.value = '';
        }
    }

</script>
public ActionResult Footer()
{
    return View();
}

Output be like the below.

dialog

See Also