Revision: 11019
Updated Code
at January 21, 2009 07:30 by leonbda
Updated Code
// add reference like this HtmlGenericControl script1 = new HtmlGenericControl("script"); script1.Attributes.Add("type", "text/javascript"); script1.Attributes.Add("src", "../js/prototype.js"); this.Page.Header.Controls.Add(script1); // add full script like this // first create string which contains your javascript string YahooScript = ""; YahooScript = "\n" + "YAHOO.util.Event.onContentReady(\"izbornik\", function () {\n" + "var oMenuBar = new YAHOO.widget.MenuBar(\"izbornik\", {autosubmenudisplay: true, hidedelay: 750, lazyload: true });\n" + "oMenuBar.render();\n" + "});\n"; // and then place javascript in header HtmlGenericControl script3 = new HtmlGenericControl("script"); script3.Attributes.Add("type", "text/javascript"); script3.InnerHtml = YahooScript; this.Page.Header.Controls.Add(script3); // in aspx page you can add script using Literal control // place Literal control in page Header in code view. // create your script string string temaSkripta = ""; temaSkripta = "\n" + "function kojaTema()\n" + "{" + "var tema = '" + tema + "';\n" + "return tema;" + "}"; // find Literal in heder and make your string it's text. Literal L = (Literal)Header.FindControl("Literal1"); L.Text = temaSkripta;
Revision: 11018
Updated Code
at January 21, 2009 07:29 by leonbda
Updated Code
// add reference like this HtmlGenericControl script1 = new HtmlGenericControl("script"); script1.Attributes.Add("type", "text/javascript"); script1.Attributes.Add("src", "../js/prototype.js"); this.Page.Header.Controls.Add(script1); // add full script like this // first create string which contains your javascript string YahooScript = ""; YahooScript = "\n" + "YAHOO.util.Event.onContentReady(\"izbornik\", function () {\n" + "var oMenuBar = new YAHOO.widget.MenuBar(\"izbornik\", {autosubmenudisplay: true, hidedelay: 750, lazyload: true });\n" + "oMenuBar.render();\n" + "});\n"; // and then place javascript in header HtmlGenericControl script3 = new HtmlGenericControl("script"); script3.Attributes.Add("type", "text/javascript"); script3.InnerHtml = YahooScript; this.Page.Header.Controls.Add(script3); // add script using Literal control // place Literal control in page Header in code view. // create your script string string temaSkripta = ""; temaSkripta = "\n" + "function kojaTema()\n" + "{" + "var tema = '" + tema + "';\n" + "return tema;" + "}"; // find Literal in heder and make your string it's text. Literal L = (Literal)Header.FindControl("Literal1"); L.Text = temaSkripta;
Revision: 11017
Updated Code
at January 21, 2009 07:18 by leonbda
Updated Code
// add reference like this HtmlGenericControl script1 = new HtmlGenericControl("script"); script1.Attributes.Add("type", "text/javascript"); script1.Attributes.Add("src", "../js/prototype.js"); this.Page.Header.Controls.Add(script1); // add full script like this // first create string which contains your javascript string YahooScript = ""; YahooScript = "\n" + "YAHOO.util.Event.onContentReady(\"izbornik\", function () {\n" + "var oMenuBar = new YAHOO.widget.MenuBar(\"izbornik\", {autosubmenudisplay: true, hidedelay: 750, lazyload: true });\n" + "oMenuBar.render();\n" + "});\n"; // and then place javascript in header HtmlGenericControl script3 = new HtmlGenericControl("script"); script3.Attributes.Add("type", "text/javascript"); script3.InnerHtml = YahooScript; this.Page.Header.Controls.Add(script3);
Revision: 11016
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 21, 2009 07:14 by leonbda
Initial Code
HtmlGenericControl script1 = new HtmlGenericControl("script"); script1.Attributes.Add("type", "text/javascript"); script1.Attributes.Add("src", "../js/prototype.js"); this.Page.Header.Controls.Add(script1);
Initial URL
Initial Description
Place javascrip refernce or complete javascript code in page header from ascx or aspx file.
Initial Title
Programmatically add javascrip refernce (or full script) in page header
Initial Tags
javascript
Initial Language
C#