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

With DropDownButton can one item or the parent item be disabled?

As the title says, can an item and/or the button be disabled? Looks like there's no property of such.

Thanks,

3 Replies

SA Sridhar Alagiri Samy Syncfusion Team January 15, 2020 06:51 PM UTC

Hi J 
  
Good day to you. 
 
We have analyzed your requirement “With DropDownButton can one item or the parent item be disabled?” in Blazor DropDownButton and you can achieve your requirement by using Disabled property to disable the dropdown button and using OnItemRender event to disable the dropdown item, as per in below code snippet.
 
Index.razor 
 
<EjsDropDownButton Disabled="true" Content="Disabled Button">
  <DropDownButtonItems>
     <DropDownButtonItem Text="Dashboard"></DropDownButtonItem>
     <DropDownButtonItem Text="Notifications"></DropDownButtonItem>
     <DropDownButtonItem Text="User Settings"></DropDownButtonItem>
     <DropDownButtonItem Text="Log Out"></DropDownButtonItem>
  </DropDownButtonItems>
</EjsDropDownButton>

<EjsDropDownButton Content="Profile">
  <DropDownButtonEvents OnItemRender="@itemRender"></DropDownButtonEvents>
<DropDownButtonItems>
    <DropDownButtonItem Text="Dashboard"></DropDownButtonItem>
    <DropDownButtonItem Text="Notifications"></DropDownButtonItem>
    <DropDownButtonItem Text="User Settings"></DropDownButtonItem>
    <DropDownButtonItem Text="Log Out"></DropDownButtonItem>
  </DropDownButtonItems>
</EjsDropDownButton>

@code {
private void itemRender(MenuEventArgs args)
{
  if (args.Item.Text == "Notifications")
  {
    args.Element.AddClass(new string[] { "e-disabled" });
  }
}
 
 
Sample link: 
 
Could you please check the above sample and get back to us with more information if we misunderstood your requirement or need further assistance. 
 
Regards,  
Sridhar A.



J j January 17, 2020 04:13 AM UTC

I'll check on this soon.
Thanks for the quick response.


SD Saranya Dhayalan Syncfusion Team January 20, 2020 04:45 AM UTC

Hi J, 
 
Thanks for your update. 
 
We will wait to hear from you. Please get back to us if you need further assistance on this? 
 
Regards, 
Saranya D 


Loader.
Live Chat Icon For mobile
Up arrow icon