示例#1
0
    private void _populateEligibleControls(List <string> allControls, List <msPortalControlPropertyOverride> eligibleControls)
    {
        _populateEligibleControls(allControls, eligibleControls, this.Page);

        // now, populate the title
        LiteralControl lc = null;
        bool           doNotAddControl = false;

        var pageTitleContent = PageTitle;

        // Check if the PageTitle content is wrapping another PageTitle (happens for the DataPage Master Page)
        var childControl = PageTitle.FindControl("PageTitle") as ContentPlaceHolder;

        if (childControl != null)
        {
            pageTitleContent = childControl;
        }

        foreach (var c in pageTitleContent.Controls)
        {
            if (c is LiteralControl && lc == null)
            {
                lc = (LiteralControl)c;
            }

            if (c is Literal) // there's already a literal
            {
                doNotAddControl = true;
            }
        }

        if (lc != null && !doNotAddControl)
        {
            var ppo = new msPortalControlPropertyOverride
            {
                PageName     = Request.Url.LocalPath,
                ControlName  = "__PageTitle",
                PropertyName = "Text",
                Value        = lc.Text
            };
            ppo["Type"] = typeof(LiteralControl).Name;

            eligibleControls.Add(ppo);
        }

        OnAddCustomOverrideEligibleControlsEvent(eligibleControls);
    }