Harsheet
Harsheet

Reputation: 628

How to remove an existing button on a tab in uCommerce?

I am working with uCommerce and I want to remove one of the add buttons on an existing tab.

I followed this Removing a button section on this article

Everything is working fine but I dont know what is imageButtom inside the RemoveMenuButtion() method.

Here is the code I have -

public PipelineExecutionResult Execute(SectionGroup subject)
        {
            if (subject.GetViewName() != Constants.UI.Pages.Orders.Order)
                return PipelineExecutionResult.Success;

            var section = subject.Sections.FirstOrDefault(s => s.OriginalName == Constants.UI.Sections.Orders.Order.Shipping);

            if (section == null) return PipelineExecutionResult.Success;

            var imageButton = new ImageButton { ImageUrl = $"{_pathService.GetPath()}/images/ui/add.png"};       

            section.Menu.RemoveMenuButtion(imageButton);

            return PipelineExecutionResult.Success;
        }

I think the problem is here-

 var imageButton = new ImageButton { ImageUrl = $"{_pathService.GetPath()}/images/ui/add.png"};   

But not sure, as there is nothing specific on the documentation though.

Any help is highly appreciated.

Thanks

Upvotes: 0

Views: 56

Answers (1)

Harsheet
Harsheet

Reputation: 628

For anyone looking for an answer to this.

You'll need to find the button in the section's menu, you will need to find the button in the collection shown below and then remove that button, as the remove works by object reference.

section.Menu.ImageButtons

Thanks

Upvotes: 0

Related Questions