protected override void Render (HtmlTextWriter writer) { ScriptTextWriter scriptwriter = new ScriptTextWriter (writer); scriptwriter.WriteStartElement ("script"); scriptwriter.WriteAttributeString ("type", "text/xml-script"); scriptwriter.WriteStartElement ("page"); scriptwriter.WriteAttributeString ("xmlns:script", "http://schemas.microsoft.com/xml-script/2005"); scriptwriter.WriteStartElement ("components"); foreach (IScriptComponent component in mgr.Components) { if (((IScriptObject)component).Owner == null) // only render the toplevel script objects component.RenderScript (scriptwriter); } scriptwriter.WriteEndElement (); // components scriptwriter.WriteStartElement ("references"); foreach (string scriptPath in mgr.ScriptRefs.Keys) { if ((bool)mgr.ScriptRefs[scriptPath]) { scriptwriter.WriteStartElement ("add"); scriptwriter.WriteAttributeString ("src", scriptPath); scriptwriter.WriteEndElement (); } } scriptwriter.WriteEndElement (); //references scriptwriter.WriteEndElement (); // page scriptwriter.WriteEndElement (); // script ScriptManager.Pages.Remove (Page); }
protected override void AddAttributesToElement (ScriptTextWriter writer) { base.AddAttributesToElement (writer); // MS raises a NRE when this is called from // our tests. speculation: they're accessing // Browser or Page to figure out if they // should be rendering attributes. }
protected override void RenderScriptTagContents(ScriptTextWriter writer) { base.RenderScriptTagContents(writer); if (AutoCompletionServiceMethod != "" && AutoCompletionServiceUrl != "") { writer.WriteStartElement("behaviors"); writer.WriteStartElement("autoComplete"); writer.WriteAttributeString("serviceURL", AutoCompletionServiceUrl); writer.WriteAttributeString("serviceMethod", AutoCompletionServiceMethod); if (AutoCompletionMinimumPrefixLength != 0) { writer.WriteAttributeString("minimumPrefixLength", AutoCompletionMinimumPrefixLength.ToString()); } writer.WriteAttributeString("completionList", ID + "__autocomplete"); // XXX ? writer.WriteEndElement(); // autoComplete writer.WriteEndElement(); // behaviors } }
public void Render() { SetPropertyAction a = new SetPropertyAction(); StringWriter sw; ScriptTextWriter w; // test an empty action sw = new StringWriter(); w = new ScriptTextWriter(sw); a.RenderAction(w); Assert.AreEqual("<setProperty />", sw.ToString(), "A1"); // test with a property a.Target = "target"; a.Property = "property"; a.PropertyKey = "propertyKey"; a.Value = "value"; sw = new StringWriter(); w = new ScriptTextWriter(sw); a.RenderAction(w); Assert.AreEqual("<setProperty target=\"target\" property=\"property\" propertyKey=\"propertyKey\" value=\"value\" />", sw.ToString(), "A2"); // test with a target and id a.ID = "set_id"; a.Target = "target"; a.Property = "property"; a.PropertyKey = "propertyKey"; a.Value = "value"; sw = new StringWriter(); w = new ScriptTextWriter(sw); a.RenderAction(w); Assert.AreEqual("<setProperty id=\"set_id\" target=\"target\" property=\"property\" propertyKey=\"propertyKey\" value=\"value\" />", sw.ToString(), "A3"); }
protected override void Render(HtmlTextWriter writer) { ScriptTextWriter scriptwriter = new ScriptTextWriter(writer); scriptwriter.WriteStartElement("script"); scriptwriter.WriteAttributeString("type", "text/xml-script"); scriptwriter.WriteStartElement("page"); scriptwriter.WriteAttributeString("xmlns:script", "http://schemas.microsoft.com/xml-script/2005"); scriptwriter.WriteStartElement("components"); foreach (IScriptComponent component in mgr.Components) { if (((IScriptObject)component).Owner == null) // only render the toplevel script objects { component.RenderScript(scriptwriter); } } scriptwriter.WriteEndElement(); // components scriptwriter.WriteStartElement("references"); foreach (string scriptPath in mgr.ScriptRefs.Keys) { if ((bool)mgr.ScriptRefs[scriptPath]) { scriptwriter.WriteStartElement("add"); scriptwriter.WriteAttributeString("src", scriptPath); scriptwriter.WriteEndElement(); } } scriptwriter.WriteEndElement(); //references scriptwriter.WriteEndElement(); // page scriptwriter.WriteEndElement(); // script ScriptManager.Pages.Remove(Page); }
public void AddAttributes(ScriptTextWriter w) { AddAttributesToElement(w); }
protected override void AddAttributesToElement(ScriptTextWriter writer) { base.AddAttributesToElement(writer); }
protected override void AddAttributesToElement(ScriptTextWriter writer) { Console.WriteLine("'" + Writer.ToString() + "'"); Console.WriteLine(Environment.StackTrace); base.AddAttributesToElement(writer); }
protected override void RenderScriptTagContents(ScriptTextWriter writer) { Console.WriteLine("'" + Writer.ToString() + "'"); Console.WriteLine(Environment.StackTrace); base.RenderScriptTagContents(writer); }