Inheritance: ScriptPlaceholder
Beispiel #1
0
        private void ProcessChildrenIDs(Control Parent, ref List<string> controls, ref ScriptPlaceHolderTop scriptsBefore, Boolean skipNamespaceCheck)
        {
            foreach (Control child in Parent.Controls)
            {
                if (child != this)
                {
                    if (child.ID != null)
                    {
                        controls.Add(
                            string.Format(
                                "{0}:{1}('{2}{3}')",
                                child.ID,
                                (scriptsBefore.ObjectInitFunction == null ? "$" : scriptsBefore.ObjectInitFunction),
                                (scriptsBefore.RequiresHash ? "#" : string.Empty),
                                child.ClientID
                                ));
                    }

                    if (child.HasControls() && (!child.GetType().Namespace.ToLower().Contains("custom") || skipNamespaceCheck))
                    {
                        ProcessChildrenIDs(child, ref controls, ref scriptsBefore, false);
                    }
                }
            }
        }
Beispiel #2
0
        private void ensureScriptPlaceHolderTopExists()
        {
            if (scriptsTopPlaceholder == null)
            {
                scriptsTopPlaceholder = (ScriptPlaceHolderTop)findPlaceholder(this.Page, typeof(ScriptPlaceHolderTop));
            }

            if (scriptsTopPlaceholder == null)
            {
                scriptsTopPlaceholder = new ScriptPlaceHolderTop();
                scriptsTopPlaceholder.Namespace = "FynyddScriptCollector"; //default if one is not present
                if (!UseCacheSafeInjectionMethods)
                {
                    this.Page.Header.Controls.Add(scriptsTopPlaceholder);
                }
                else
                {
                    //do nothing, the javascript will handle it, but we need the server side object for reference
                }
            }
        }