You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何移除案例界面活动标签页添加活动下拉菜单默认选项并移至工具栏?

How to Remove Dropdown Options and Move Them to the Toolbar in Case Activity Tab

Great question! Let's walk through exactly how to achieve this—you're right that Base.action.AddMenuAction() is part of the solution, but you'll need to modify backend code (not just ASPX) to remove the existing dropdown items. Here's a step-by-step breakdown:

1. Remove Target Options from the "Add Activity" Dropdown

The dropdown menu and its items are typically populated via backend code (not just ASPX markup), so you'll need to intercept the menu collection and remove the unwanted items. Here's how to do it in C# (adjust for VB if needed):

protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
    
    // Locate the "Add Activity" dropdown menu (use the actual action name/ID from your system)
    var addActivityDropdown = Base.Actions.FindAction("AddActivity") as DropDownMenuAction;
    
    if (addActivityDropdown != null)
    {
        // Remove the specific items by their action names
        addActivityDropdown.Actions.RemoveAll(action => 
            action.Name.Equals("AddNote", StringComparison.OrdinalIgnoreCase) ||
            action.Name.Equals("AddPhoneCall", StringComparison.OrdinalIgnoreCase) ||
            action.Name.Equals("AddWorkItem", StringComparison.OrdinalIgnoreCase));
        
        // Optional: Hide the entire dropdown if it's empty after removal
        if (!addActivityDropdown.Actions.Any())
        {
            Base.Actions.Remove(addActivityDropdown);
        }
    }
}

Make sure to replace "AddActivity" with the actual unique ID/name of your "Add Activity" dropdown menu—you can find this by inspecting the page source or checking your system's menu configuration.

2. Add the Options Directly to the Toolbar

Now use AddMenuAction() (or the appropriate method for your system's action type) to add these items directly to the toolbar's top-level actions:

// Add "Add Note" to the toolbar
var addNoteAction = new MenuAction
{
    Name = "AddNote",
    Text = "Add Note",
    CommandName = "AddNote", // Matches the original command to retain functionality
    ImageUrl = "~/Images/NoteIcon.png" // Optional: Add an icon for better UX
};
Base.Actions.Add(addNoteAction);

// Add "Add Phone Call"
var addPhoneCallAction = new MenuAction
{
    Name = "AddPhoneCall",
    Text = "Add Phone Call",
    CommandName = "AddPhoneCall",
    ImageUrl = "~/Images/PhoneIcon.png"
};
Base.Actions.Add(addPhoneCallAction);

// Add "Add Work Item"
var addWorkItemAction = new MenuAction
{
    Name = "AddWorkItem",
    Text = "Add Work Item",
    CommandName = "AddWorkItem",
    ImageUrl = "~/Images/WorkItemIcon.png"
};
Base.Actions.Add(addWorkItemAction);

This ensures the items retain their original functionality while moving them to the toolbar.

3. Do You Only Need to Modify ASPX?

No—ASPX files primarily handle rendering the UI, but the menu structure and action bindings are controlled by backend code (your page's code-behind file, e.g., CaseActivityTab.aspx.cs). You'll need to add the above logic to the code-behind, though you might need to adjust ASPX markup if your toolbar requires specific container controls (most systems handle this automatically via the action framework).

Key Notes:

  • Double-check action names/IDs to match your system's existing configuration—mismatched names will break functionality.
  • If your system uses a different action type (e.g., ToolbarButtonAction instead of MenuAction), adjust the code to use the correct class.
  • Test thoroughly to ensure removing items doesn't break other dependencies in the case activity tab.

内容的提问来源于stack exchange,提问作者Krunal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 06:35:50