|
DialogFeatures.cshtml
<ej-dialog id="basicDialog" title="Audi-Q3 Drive" content-type="ajax" content-url="@Url.Content("~/Dialog/AjaxContent").ToString()" open="onopen"> // Dialog open event
</ej-dialog> |
|
DialogFeatures.cshtml
<script>
function onopen(e) { // Triggered when dialog was opened
$("#InvoiceType").ejDropDownList("selectItemByValue", 1);
$(document).ready(function () {
$("#ContractNumber").prev().focus(); // Focused particular text box
});
}
</script> |
|
<script>
function onopen(e) { // Triggered when dialog was opened
$(document).ready(function () {
$("#ContractNumber").ejNumericTextbox("instance")._hiddenInput.focus();// Focused particular text box
});
}
</script> |
|
AjaxContent.cshtml
<form id="myform">
<div id="content">
<div>
<div class="container-fluid">
<div class="row">
…………
<div class="col">
<label for="ContractNumber">Contract Number</label>
<input id="ContractNumber" type="text" />
</div>
</div>
</div>
</div>
</div>
</form>
<script>
$("#ContractNumber").ejNumericTextbox({
showRoundedCorner: true,
groupSeparator: "",
width: '90',
showSpinButton: false
});
$("#InvoiceType").ejDropDownList({});
$("#YearID").ejNumericTextbox({…});
</script> |
|
DialogFeatures.cshtml
<ej-button click="onclick" /> // Button with click event
<ej-dialog id="basicDialog" content-type="ajax" show-on-init="false" enable-animation="false"> // Dialog control without contentUrl
</ej-dialog>
<script>
function onclick(args) { // Triggered when button is clicked
dialogObj = $("#basicDialog").ejDialog("instance") // Dialog object
dialogObj.option("contentUrl", '/Dialog/AjaxContent'); // Set contentUrl into dialog
dialogObj.open(); // Dialog open
$("#ContractNumber").prev().focus(); // Focused on particular element
}
</script> |
|
DialogFeature.cshtml
<ej-button id="mute" click="onclick" />
<ej-dialog id="basicDialog" content-type="ajax" show-on-init="false" ajax-success="success" enable-animation="false"> // Dialog ajax success event
</ej-dialog>
<script>
function onclick(args) { // Triggered when external button clicked
dialogObj = $("#basicDialog").ejDialog("instance")
dialogObj.option("contentUrl", '/Dialog/AjaxContent');
dialogObj.open();
$("#mute").hide();
$("#ContractNumber").prev().focus(); // Set focused whenever open dialog(this is not included on first time)
}
function success(args) {
$("#ContractNumber").prev().focus(); // Set focused on particular element after ajax post succeeded
}
</script> |
|
AjaxContent.cshtml
<div class="col">
<label for="InvoiceType">Type</label> // Drop down list
<input type="text" id="InvoiceType" />
</div>
<script>
var dataManager = ej.DataManager({
url: "/Dialog/GetCities",
adaptor: new ej.WebApiAdaptor()
});
$("#InvoiceType").ejDropDownList({ // Rendering dropdown list
dataSource: dataManager,
value: "a", // Set value to drop down list
fields: { text: "CityName", value: "id" },
watermarkText: "Select City",
});
</script>
|