May have found a functionality bug - AllowEditing false does not work when using SfGrid & SfDropDownList

Good evening,

I think I may have found a bug when trying to disable a column from being edited but available when adding when using a SfDropDownList for selecting a valid record.

I have tried to implement it two ways - one by setting 

AllowEditing="false" and by using a variable.

AllowEditing="false".

I have attached the razor file...

Data is as follows:

Image_8870_1785194308008

Image_4009_1785194356480

When I test it using the Points per shirt column it words as expected so the only difference between the two columns is that one uses  SfDropDownList while the other is default.

Thanks

SCG



Attachment: Item_.razor_e17ed7b6.txt

2 Replies

SG Stephane Godbout July 27, 2026 11:34 PM UTC

Here are the models:

using System;

using System.Collections.Generic;

using System.Text;


namespace ITSPBlazorLibrary.Models

{

    public class AccountModel

    {

        public int AccountId { get; set; }

        public required string Name { get; set; }

        public required string AccountType { get; set; }

    }

}


using System.ComponentModel.DataAnnotations;


namespace ITSPBlazorLibrary.Models;


public class ItemModel

{


    public static List<ItemModel> Items = new List<ItemModel>();


    public ItemModel(string itemNumber, string name, decimal pointsPerShirt, decimal unitMultiplier, int expenseAccount, int revenueAccount, bool deleted)

    {

        ItemNumber = itemNumber;

        Name = name;

        PointsPerShirt = pointsPerShirt;

        UnitMultiplier = unitMultiplier;

        ExpenseAccount = expenseAccount;

        RevenueAccount = revenueAccount;

        Deleted = deleted;

    }


    [Required(ErrorMessage ="Item Numnber is required.")]

    [Display(Name = "Item Number")]

    [Key]

    [StringLength(52,MinimumLength =1,ErrorMessage ="Item Number must be between 1 and 52 characters")]

    public string ItemNumber { get; set; }


    [Required(ErrorMessage = "Item Name is required.")]

    [Display(Name = "Item Name")]

    [StringLength(75, MinimumLength = 1, ErrorMessage = "Item Name must be between 1 and 75 characters")]

    public string Name { get; set; }



    [Required(ErrorMessage = "Revenue Account is required.")]

    [Range(4000,4999,ErrorMessage ="Revenue Account must be between 4000 and 4999 and must be a valid revenue account in Simply")]

    public int RevenueAccount { get; set; }


    [Required(ErrorMessage = "Expense Account is required.")]

    [Range(5000, 5999, ErrorMessage = "Revenue Account must be between 5000 and 5999 and must be a valid expense account in Simply")]

    public int ExpenseAccount { get; set; }


    [Required(ErrorMessage = "Points per Shirt number is required.")]

    [Range(-1.0, 10.0, ErrorMessage = "Points per Shirt must be between 0 and 10")]

    public decimal PointsPerShirt { get; set; }


    [Required(ErrorMessage = "Multiplier used for calculation is required.")]

    [Range(-1, 1, ErrorMessage = "Multiplier must be either 0 (not included in the calculation of the number of shirts printed) or 1.")]

    public decimal UnitMultiplier { get; set; }


    [Required]

    public bool Deleted { get; set; }


}






PS Prathap Senthil Syncfusion Team July 28, 2026 01:06 PM UTC

Hi Stephane Godbout,


Based on your reported scenario, we would like to clarify that when a custom EditTemplate is defined, the controls within the template (such as SfDropDownList) are rendered during edit/add operations regardless of the column's AllowEditing setting. The AllowEditing="false" property prevents the Grid's built-in editing for that column but does not automatically disable controls rendered inside the EditTemplate. If your requirement is to allow selection only when adding a new record and prevent modification during edit, we recommend controlling the dropdown's state within the EditTemplate using the Enabled property. You can enable or disable the dropdown dynamically using the RowEditing and RowCreated events to achieve your requirement. Kindly refer to the code snippet and sample below for your reference.


Code Snippet:

<SfGrid DataSource="@items"

        @ref="Grid"

        Toolbar="@(new List<string> { "Add", "Edit", "Update", "Cancel" })"

-------------------

        <GridColumn Field=@nameof(ItemModel.RevenueAccount)

                    HeaderText="Revenue Account"

                    AllowEditing="false"

                    Width="150">

            <EditTemplate>

                @{

                    var item = context as ItemModel;

                }

 

                <SfDropDownList TValue="int"

                                TItem="AccountModel"

                                Enabled="@Iseditable"

                                DataSource="@revenueAccounts"

                                @bind-Value="@item!.RevenueAccount">

 

                    <DropDownListFieldSettings Text="Name"

                                               Value="AccountId">

                    </DropDownListFieldSettings>

 

                </SfDropDownList>

            </EditTemplate>

        </GridColumn>

 

        <GridColumn Field=@nameof(ItemModel.ExpenseAccount)

                    HeaderText="Expense Account"

                    AllowEditing=@iSFieldEditable

                    Width="150">

            <EditTemplate>

                @{

                    var item = context as ItemModel;

                }

 

                <SfDropDownList TValue="int"

                                TItem="AccountModel"

                                Enabled="@Iseditable"

                                DataSource="@expenseAccounts"

                                @bind-Value="@item!.ExpenseAccount">

 

                    <DropDownListFieldSettings Text="Name"

                                               Value="AccountId">

                    </DropDownListFieldSettings>

 

                </SfDropDownList>

            </EditTemplate>

        </GridColumn>

 

-------------

</SfGrid>

 

@code {

 

 

    public bool Iseditable { get; set; }

 

    public async Task RowCreatingEvent(RowCreatingEventArgs<ItemModel> args)

    {

        Iseditable = true;

    }

 

    public async Task RowEditingEvent(RowEditingEventArgs<ItemModel> args)

    {

        Iseditable = false;

    }


Sample: https://blazorplayground.syncfusion.com/embed/LNVxjmLPpTUZXIZm?appbar=true&editor=true&result=true&errorlist=true&theme=fluent2


UG:

https://blazor.syncfusion.com/documentation/datagrid/editing

https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DropDowns.SfDropDownList-2.html#Syncfusion_Blazor_DropDowns_SfDropDownList_2_Enabled

https://blazor.syncfusion.com/documentation/datagrid/events#rowupdating

https://blazor.syncfusion.com/documentation/datagrid/events#rowcreating


Regards,
Prathap Senthil



Loader.
Up arrow icon