<div class="control-section">
@Html.EJS().Grid("DialogTemplateEdit").DataSource((IEnumerable<object>)ViewBag.dataSource).ActionComplete("actionComplete").Columns(col =>
{
. . .
}).AllowPaging().PageSettings(page => page.PageCount(2)).EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Dialog).Template("#dialogtemplate"); }).Toolbar(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" }).Render()
</div>
<script>
var div = ej.base.createElement('div', { id: 'dlg' });
function actionComplete(args) {
if (args.requestType === 'beginEdit') {
args.dialog.header = 'Edit Dialog';
. . . }
if (args.requestType === 'add') {
args.dialog.header = 'Add Dialog';
. . .
}
}
</script> |
<div class="control-section">
@Html.EJS().Grid("DialogTemplateEdit").DataSource((IEnumerable<object>)ViewBag.dataSource).ActionComplete("actionComplete").Columns(col =>
{
. . .
}).AllowPaging().PageSettings(page => page.PageCount(2)).EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Dialog).Template("#dialogtemplate"); }).Toolbar(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" }).Render()
</div>
<script>
function actionComplete(args) {
if (args.requestType === 'beginEdit') {
args.dialog.height = '400px';
. . .
}
}
</script> |
<div class="control-section">
@Html.EJS().Grid("DialogTemplateEdit").DataSource((IEnumerable<object>)ViewBag.dataSource).ActionComplete("actionComplete").Columns(col =>
{
. . .
}).AllowPaging().PageSettings(page => page.PageCount(2)).EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Dialog).Template("#dialogtemplate"); }).Toolbar(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" }).Render()
</div>
<script>
function actionComplete(args) {
. . .
if (args.requestType === 'save') {
var toastObj = new ej.notifications.Toast({
position: {
X: 'Right'
}, target: document.body
});
toastObj.appendTo('#DialogTemplateEdit');
toastObj.show({ title: 'Information!', content: 'You can Print the data now.', cssClass: 'e-toast-info', icon: 'e-info toast-icons' });
}
}
</script> |
namespace mvc_ej2
{
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
. . . . .
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css")); // remove the default site.css
}
}
}
|
<style>
.e-dlg-content .e-gridform input, select, textarea {
max-width: 100% !important;
}
</style> |