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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

150634 Jan 14,2020 09:02 AM UTC Jan 20,2020 04:45 AM UTC Blazor 3
loading
Tags: Button
j
Asked On January 14, 2020 09:02 AM UTC

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

Thanks,

Sridhar Alagiri Samy [Syncfusion]
Replied On 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
Replied On January 17, 2020 04:13 AM UTC

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

Saranya Dhayalan [Syncfusion]
Replied On 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 


CONFIRMATION

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