Component parameter should not be set outside of it component

I'm disabling ContextMenu items inside an SfGrid and getting a warning that the "Component parameter 'Disabled' should not be set outside of its component."  This same warning happens for any parameter, including hiding the item.  This code is, basically, right out of the example on how to do it.  Just wanted to let you know so you can correct the warning.  I'm using the latest release, v30.1.40.

Image_1629_1752761158595


1 Reply

GR Guhanathan Ramanathan Syncfusion Team July 18, 2025 09:45 AM UTC

Hi  ,

Greetings from Syncfusion

We reviewed your query and understand that you are encountering the warning, “Component parameter Disabled should not be set outside of its component.” This warning can be suppressed using the approach shown below.  Please refer to the following code snippet for reference. 

 

<SfGrid DataSource="@Orders" AllowGrouping="true" AllowFiltering="true" AllowPaging="true" ContextMenuItems="@(new List<object>() { "AutoFit", "AutoFitAll", "SortAscending", "SortDescending","Copy", "Edit", "Delete", "Save", "Cancel","PdfExport", "ExcelExport", "CsvExport", "FirstPage", "PrevPage","LastPage", "NextPage"})">

    <GridEvents ContextMenuOpen="ContextMenuOpenHandler" TValue="Order"></GridEvents>

    <GridFilterSettings Type="@Syncfusion.Blazor.Grids.FilterType.CheckBox"></GridFilterSettings>

    <GridGroupSettings ShowGroupedColumn="true"></GridGroupSettings>

    <GridColumns>

        <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>

        <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn>

        <GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>

        <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>

    </GridColumns>

</SfGrid>

 

@code {

    public List<Order> Orders { get; set; }

 

    protected override void OnInitialized()

    {

        Orders = Enumerable.Range(1, 75).Select(x => new Order()

            {

                OrderID = 1000 + x,

                CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],

                Freight = 2.1 * x,

                OrderDate = DateTime.Now.AddDays(-x),

            }).ToList();

    }

 

    public class Order

    {

        public int? OrderID { get; set; }

        public string CustomerID { get; set; }

        public DateTime? OrderDate { get; set; }

        public double? Freight { get; set; }

    }

 

    public void ContextMenuOpenHandler(ContextMenuOpenEventArgs<Order> args)

    {

#pragma warning disable BL0005

        args.ContextMenu.Items[1].Disabled = true;

#pragma warning restore BL0005

    }

}




Regards,
Guhanathan R


Loader.
Up arrow icon