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
close icon

Grid Cell Edit Template does not work

Dear Sir,

 <EjsGrid  DataSource="@requestProducts" @ref="@RequestProductGrid" ModelType="@ReqModel" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })">
            <GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true"></GridEditSettings>
            <GridColumns>
                <GridColumn  Field=@nameof(RequestProduct.ProductId) HeaderText="Product Name" ForeignKeyValue="Name" DataSource="@products" Width="150">
                    <EditTemplate>
                        @{
                            <EjsComboBox ID="Id" Value="@((context as RequestProduct).ProductId)" TValue="int?" DataSource="@products">
                                <ComboBoxFieldSettings Text="Name" Value="Id"></ComboBoxFieldSettings>
                            </EjsComboBox>
                        }
                    </EditTemplate>
                </GridColumn>

                <GridColumn Field=@nameof(RequestProduct.Quantity) HeaderText="Quantity" EditType="EditType.NumericEdit" TextAlign="TextAlign.Right" Width="140"></GridColumn>
                <GridColumn Field=@nameof(RequestProduct.Priority) HeaderText="Priority" EditType="EditType.DropDownEdit" TextAlign="TextAlign.Right" Width="160"></GridColumn>
                <GridColumn Field=@nameof(RequestProduct.Note) HeaderText="Note" EditType="EditType.DefaultEdit" Width="150"></GridColumn>
            </GridColumns>

Please find the attached Video. 

Regards
Vijay

Attachment: Inventory__Edited_8c1022ae.7z

2 Replies

VI vijaymohan November 4, 2019 05:43 AM UTC

Dear Sir,

Any update on this?

Regards
Vijay


VN Vignesh Natarajan Syncfusion Team November 4, 2019 05:46 AM UTC

Hi VijayMohan,  

Greetings from Syncfusion support.  

Query: “Grid CellEdit Template does not work” 

We have analyzed the provided video demonstration, code example and found that ID property of EjsComboBox is different from the Field value. ID property of edit template component must be same as the Field value of that column.  

But in your sample, you have used ID property as one variable (“Id”) which is different from columns field (“ProductId”) property, hence the reported issue is occurred. Kindly modify the ID property as ProductId to resolve the issue.  

Refer the below modified code example.  

<GridColumn Field=@nameof(RequestProduct.ProductId) HeaderText="Product Name" ForeignKeyValue="Name" DataSource="@products" Width="150"> 
    <EditTemplate> 
        @{ 
            <EjsComboBox ID="ProductId" Value="@((context as RequestProduct).ProductId)" TValue="int?" DataSource="@products"> 
                <ComboBoxFieldSettings Text="Name" Value="Id"></ComboBoxFieldSettings> 
            </EjsComboBox> 
        } 
    </EditTemplate> 
</GridColumn> 

Also in your code example, you have not enabled IsPrimaryKey property to any of the available column. Based on the PrimaryKey column value only CRUD operation will take place. So IsPrimaryKey property must be define to any of available column which has unique values.  

Refer our UG documentation for your reference 



Please get back to us if you have further queries.  

Regards, 
Vignesh Natarajan.

Loader.
Live Chat Icon For mobile
Up arrow icon