We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Restrict decimals for child grid

Thread ID:





146194 Jul 24,2019 11:47 PM UTC Jul 26,2019 06:54 AM UTC ASP.NET Core - EJ 2 3
Tags: DataGrid
Javier A Aguilera
Asked On July 24, 2019 11:47 PM UTC

Good afternoon,

I'm trying to restrict the decimals of the numeric field "orden" in child grid. Currently, I have the field "Orden" in the parent grid and it doesnt have decimal positions which is correct. But I want to do so in the child grid for its own "Orden" field but I dont know how.

Probably it is very similar with the instructions: ValidateDecimalOnType = true, Decimals = 0, Format = "N"...... but I don´t know exactly how.

Can you please help me??

In advance, thanks!!

////////////////////////MY CODE////////////////////////

    ViewData["Title"] = "Catálogo de coberturas póliza hogar";
    Layout = "~/Areas/Sistema/Views/Shared/_Layout.cshtml";

<h2>Catálogo de coberturas póliza hogar</h2>

    var dataManager2 = new Syncfusion.EJ2.DataManager()

        Adaptor = "UrlAdaptor",
        Url = "/Sistema/Catalogos/coberturasCategoriasHogarGrid_Read/ ",
        CrudUrl = "/Sistema/Catalogos/coberturasCategoriasHogarGrid_CRUD/ ",
        RequestType = "Post",
        CrossDomain = true

    var childGrid = new Syncfusion.EJ2.Grids.Grid()
        DataSource = dataManager2,
        QueryString = "categoriaID",
        Toolbar = new List<string>() { "Cancel", "Update", "Add", "Delete" },
        EditSettings = new Syncfusion.EJ2.Grids.GridEditSettings()
            AllowAdding = true,
            AllowEditing = true,
            AllowDeleting = true
        Columns = new List<Syncfusion.EJ2.Grids.GridColumn>
            new Syncfusion.EJ2.Grids.GridColumn(){ Field = "coberturaID", HeaderText = "coberturaID", Visible = false, Id = "categoriaID", IsPrimaryKey = true },
            new Syncfusion.EJ2.Grids.GridColumn(){ Field = "categoriaID", HeaderText = "categoriaID", Visible = false, Id = "categoriaID" },
            new Syncfusion.EJ2.Grids.GridColumn(){ Field = "nombreCobertura", HeaderText = "Nombre Cobertura"},
            new Syncfusion.EJ2.Grids.GridColumn(){ Field = "orden", HeaderText = "orden"}
        ActionBegin = "actionBegin"



<ejs-grid id="coberturasHogarGrid" childGrid="childGrid" toolbar="@(new List<string>() { "Cancel", "Update", "Add", "Delete" })">
    <e-data-manager id="dataManager" adaptor="UrlAdaptor" url="/Sistema/Catalogos/coberturasHogarGrid_Read" crudUrl="/Sistema/Catalogos/coberturasHogarGrid_CRUD" requestType="Post"></e-data-manager>
    <e-grid-editSettings allowDeleting="true" allowEditing="true" allowAdding="true" mode="Normal" showDeleteConfirmDialog="true"></e-grid-editSettings>
        <e-grid-column field="categoriaID" isPrimaryKey="true" isIdentity="true" visible="false"></e-grid-column>
        <e-grid-column field="nombreCategoria" headerText="Nombre de la categoría" visible="true"></e-grid-column>
        <e-grid-column field="orden" headerText="Orden" visible="true" editType="numericedit" format="N" edit="@(new { @params = new Syncfusion.EJ2.Inputs.NumericTextBox() {
            ValidateDecimalOnType = true,
            Decimals = 0,
            Format = "N"
   })" ></e-grid-column>

    function actionBegin(args) {
        if (args.requestType === "save") {
            this.query.params = [];
            this.query.addParams('categoriaID', this.parentDetails.parentRowData.categoriaID);

Hariharan J V [Syncfusion]
Replied On July 25, 2019 07:19 AM UTC

Hi Javier, 

Greetings from the Syncfusion support, 

We have validated your query provided the information and we created a sample with numeric editing in decimal of zero using edit params in the Child Grid. We have already discussed about the edit params in Help Documentation. Please refer the below code example, sample and Help Documentation for more information. 


var editParams = new { @params = new { format="N", decimals=0} }; 
    .   .    .   . 
       Columns = new List<Syncfusion.EJ2.Grids.GridColumn> 
        new Syncfusion.EJ2.Grids.GridColumn(){ Field = "OrderID", HeaderText = "OrderID", Visible = false, Id = "categoriaID", IsPrimaryKey = true }, 
        new Syncfusion.EJ2.Grids.GridColumn(){ Field = "ShipCity", HeaderText = "Ship City", Visible = false, Id = "categoriaID" }, 
        new Syncfusion.EJ2.Grids.GridColumn(){ Field = "ShipName", HeaderText = "Ship Name"}, 
        new Syncfusion.EJ2.Grids.GridColumn(){ Field = "Freight", HeaderText = "Freight", Format="N", EditType="numericedit", Edit= editParams } 
        <div class="container"> 
            <ejs-grid id="Grid" allowPaging=true childGrid="childGrid"> 
                <e-grid-pagesettings pageSize="4"> </e-grid-pagesettings> 
                <e-data-manager url='http://js.syncfusion.com/demos/ejservices//Wcf/Northwind.svc/Employees/' adaptor="ODataAdaptor" crossdomain="true"></e-data-manager> 
                .   .   .   . 

Please get back to us, if you need further assistance. 


Javier A Aguilera
Replied On July 25, 2019 07:15 PM UTC

Thank you for your fast answer, it worked perfectly!

Hariharan J V [Syncfusion]
Replied On July 26, 2019 06:54 AM UTC

Hi Javier,

Thanks for your update.

We are happy to hear that your issue has been resolved.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon