The first way is well known and you can read this technique at Dave Relyea's Blog.
The alternative technique is to create script element on the page with java script commands.
The C# code will be like this:
HtmlElement script = HtmlPage.Document.CreateElement("script");
script.SetAttribute("type", "text/javascript");
script.SetProperty("text", “alert(\”JavaScript call\”);”);
HtmlPage.Document.DocumentElement.AppendChild(script);
This method can be extended to declare java script functions . Just add js-file into your project as embedded resource. And call in this format:
System.IO.Stream s = this.GetType().Assembly.GetManifestResourceStream("Elisy.Theater.GoogleMapProviderModule.GMMP.js");
HtmlElement script = HtmlPage.Document.CreateElement("script");
script.SetAttribute("type", "text/javascript");
script.SetProperty("text", new System.IO.StreamReader(s).ReadToEnd());
HtmlPage.Document.DocumentElement.AppendChild(script);
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5