protected override Command RenderBeginTagForCommand(WebTabStripRenderingContext renderingContext, IWebTab tab, bool isEnabled, WebTabStyle style)
        {
            ArgumentUtility.CheckNotNull("style", style);

            var menuTab = ((IMenuTab)tab).GetActiveTab();
            var command = GetRenderingCommand(isEnabled, menuTab);

            var additionalUrlParameters = menuTab.GetUrlParameters();
            var backupID        = command.ItemID;
            var backupAccessKey = command.AccessKey;

            try
            {
                if (string.IsNullOrEmpty(command.ItemID) && !string.IsNullOrEmpty(tab.ItemID))
                {
                    command.ItemID = tab.ItemID + "_Command";
                }

                if (string.IsNullOrEmpty(command.AccessKey))
                {
                    var textWithHotkey = HotkeyParser.Parse(tab.Text);
                    if (textWithHotkey.Hotkey.HasValue)
                    {
                        command.AccessKey = HotkeyFormatter.FormatHotkey(textWithHotkey);
                    }
                }

                command.RenderBegin(
                    renderingContext.Writer,
                    RenderingFeatures,
                    tab.GetPostBackClientEvent(),
                    new string[0],
                    string.Empty,
                    null,
                    additionalUrlParameters,
                    false,
                    style);

                return(command);
            }
            finally
            {
                command.ItemID    = backupID;
                command.AccessKey = backupAccessKey;
            }
        }
示例#2
0
        protected virtual Command RenderBeginTagForCommand(WebTabStripRenderingContext renderingContext, IWebTab tab, bool isEnabled, WebTabStyle style)
        {
            ArgumentUtility.CheckNotNull("renderingContext", renderingContext);
            ArgumentUtility.CheckNotNull("style", style);

            var command = new Command();

            command.OwnerControl = renderingContext.Control;
            command.ItemID       = tab.ItemID + "_Command";
            if (isEnabled && tab.EvaluateEnabled())
            {
                command.Type = CommandType.Event;

                var textWithHotkey = HotkeyParser.Parse(tab.Text);
                if (textWithHotkey.Hotkey.HasValue)
                {
                    command.AccessKey = _hotkeyFormatter.FormatHotkey(textWithHotkey);
                }
            }
            else
            {
                command.Type = CommandType.None;
            }

            command.RenderBegin(
                renderingContext.Writer,
                RenderingFeatures,
                tab.GetPostBackClientEvent(),
                new string[0],
                string.Empty,
                null,
                new NameValueCollection(),
                false,
                style);

            return(command);
        }