How to customize the Edit form title of the Grid?
This knowledge base explains the way, how to customize the edit form title.
We can achieve this by using the following three options,
- Display the customized title as Edit Form title.
- Display another column value with title instead of Primary key column value.
- Change the default localize text of edit form title using Localize.
Display the customized title as Edit Form title
This can be achieved using actionComplete event in grid by setting the string value to be displayed in title attribute for dialog.
HTML
<div id="Grid"></div>
JS
<script type="text/javascript">
$(function () {
$("#Grid").ejGrid({
dataSource: window.gridData,
allowPaging: true,
actionComplete: "complete",
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, editMode: ej.Grid.EditMode.Dialog },
toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] },
columns: [
{ field: "OrderID", isPrimaryKey: true, headerText: "Order ID", width: 90 },
{ field: "CustomerID", headerText: 'Customer ID', width: 90 },
{ field: "Freight", headerText: 'Freight', format: "{0:C}",width: 75 },
{ field: "ShipCity", headerText: 'Ship City', width: 90 }
]
});
});
</script>
Razor
@(Html.EJ().Grid<object>("Grid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
.AllowPaging()
.EditSettings(edit=>{edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.Dialog)})
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.Add);
items.AddTool(ToolBarItems.Edit);
items.AddTool(ToolBarItems.Delete);
items.AddTool(ToolBarItems.Update);
items.AddTool(ToolBarItems.Cancel);
});
})
.ClientSideEvents(eve=>eve.ActionComplete("actionComplete"))
.Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add();
col.Field("Freight").HeaderText("Freight").TextAlign(TextAlign.Right).Width(75).Format("{0:C}").Add();
col.Field("ShipCity").HeaderText("Ship City").TextAlign(TextAlign.Right).Width(90).Add();
})
)
C#
namespace Sample.Controllers
{
public class GridController : Controller
{
public ActionResult GridFeatures()
{
ViewBag.datasource = new NorthwindDataContext().OrdersViews.ToList();
return View();
}
}
}
ASPX
<ej:Grid ID="Grid" runat="server" AllowPaging="True">
<ClientSideEvents ActionComplete="complete"/>
<Columns>
<ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="true" Width="75"></ej:Column>
<ej:Column Field="CustomerID" HeaderText="Customer ID" Width="80"></ej:Column>
<ej:Column Field="Freight" HeaderText="Freight" Width="75" Format="{0:C}"></ej:Column>
<ej:Column Field="ShipCity" HeaderText="ShipCity" Width="90"></ej:Column>
</Columns>
<EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True" EditMode="Dialog"></EditSettings>
<ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>
</ej:Grid>
<script type="text/javascript">
function actionComplete(args) {
if (args.requestType == "beginedit" || args.requestType == "add")
$("#"+this._id+"_dialogEdit").ejDialog({ title: "Customize Edit form title" });
}
}
</script>

Figure 1: Customized title for Edit form
Display another column value with title instead of Primary key column value:
This can be achieved by using titleColumn property of editSettings in grid which helps to set the value for edit form title.
Refer the documentation link: https://help.syncfusion.com/api/js/ejgrid#members:editsettings-titleColumn
HTML
<div id="Grid"></div>
JS
<script type="text/javascript">
$(function () {
$("#Grid").ejGrid({
dataSource: window.gridData,
allowPaging: true,
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, editMode: ej.Grid.EditMode.Dialog, titleColumn: "CustomerID"},
toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] },
columns: [
{ field: "OrderID", isPrimaryKey: true, headerText: "Order ID", width: 90 },
{ field: "CustomerID", headerText: 'Customer ID', width: 90 },
{ field: "Freight", headerText: 'Freight', format: "{0:C}",width: 75 },
{ field: "ShipCity", headerText: 'Ship City', width: 90 }
]
});
});
</script>
Razor
@(Html.EJ().Grid<object>("Grid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
.AllowPaging()
.EditSettings(edit=>{edit.AllowAdding().AllowDeleting().AllowEditing().TitleColumn("CustomerID").EditMode(EditMode.Dialog)})
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.Add);
items.AddTool(ToolBarItems.Edit);
items.AddTool(ToolBarItems.Delete);
items.AddTool(ToolBarItems.Update);
items.AddTool(ToolBarItems.Cancel);
});
})
.Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add();
col.Field("Freight").HeaderText("Freight").TextAlign(TextAlign.Right).Width(75).Format("{0:C}").Add();
col.Field("ShipCity").HeaderText("Ship City").TextAlign(TextAlign.Right).Width(90).Add();
})
)
C#
namespace Sample.Controllers
{
public class GridController : Controller
{
public ActionResult GridFeatures()
{
ViewBag.datasource = new NorthwindDataContext().OrdersViews.ToList();
return View();
}
}
}
ASPX
<ej:Grid ID="Grid" runat="server" AllowPaging="True">
<Columns>
<ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="true" Width="75"></ej:Column>
<ej:Column Field="CustomerID" HeaderText="Customer ID" Width="80"></ej:Column>
<ej:Column Field="Freight" HeaderText="Freight" Width="75" Format="{0:C}"></ej:Column>
<ej:Column Field="ShipCity" HeaderText="ShipCity" Width="90"></ej:Column>
</Columns>
<EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True" EditMode="Dialog" TitleColumn="CustomerID" ></EditSettings>
<ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>
</ej:Grid>

Figure 2: Shows CustomerID value with Edit form title
Change the default localize text of edit form title using Localization:
Based on the Localization given we can set the title for the edit form in grid. This can be achieved by using ej.Grid.Locale object when locale property in grid is used.
HTML
<div id="Grid"></div>
JS
<script type="text/javascript">
$(function () {
$("#Grid").ejGrid({
dataSource: window.gridData,
allowPaging: true,
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, editMode: ej.Grid.EditMode.Dialog},
toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] },
columns: [
{ field: "OrderID", isPrimaryKey: true, headerText: "Order ID", width: 90 },
{ field: "CustomerID", headerText: 'Customer ID', width: 90 },
{ field: "Freight", headerText: 'Freight', format: "{0:C}",width: 75 },
{ field: "ShipCity", headerText: 'Ship City', width: 90 }
]
});
});
</script>
Razor
@(Html.EJ().Grid<object>("Grid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
.AllowPaging()
.EditSettings(edit=>{edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.Dialog)})
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.Add);
items.AddTool(ToolBarItems.Edit);
items.AddTool(ToolBarItems.Delete);
items.AddTool(ToolBarItems.Update);
items.AddTool(ToolBarItems.Cancel);
});
})
.Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add();
col.Field("Freight").HeaderText("Freight").TextAlign(TextAlign.Right).Width(75).Format("{0:C}").Add();
col.Field("ShipCity").HeaderText("Ship City").TextAlign(TextAlign.Right).Width(90).Add();
})
)
C#
namespace Sample.Controllers
{
public class GridController : Controller
{
public ActionResult GridFeatures()
{
ViewBag.datasource = new NorthwindDataContext().OrdersViews.ToList();
return View();
}
}
}
ASPX
<ej:Grid ID="Grid" runat="server" AllowPaging="True">
<Columns>
<ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="true" Width="75"></ej:Column>
<ej:Column Field="CustomerID" HeaderText="Customer ID" Width="80"></ej:Column>
<ej:Column Field="Freight" HeaderText="Freight" Width="75" Format="{0:C}"></ej:Column>
<ej:Column Field="ShipCity" HeaderText="ShipCity" Width="90"></ej:Column>
</Columns>
<EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True" EditMode="Dialog" ></EditSettings>
<ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>
</ej:Grid>
<script type="text/javascript"> ej.Grid.Locale["en-US"]["EditFormTitle"] = "Showing details of "; </script>

Figure 3: Customized Edit form title using Localization
Conclusion
I hope you enjoyed learning about how to customize the Edit form title of the Grid.
You can refer to our JavaScript Grid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript Grid example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!