以下範例為加Scrip到各區塊的語法(依上到下的順序):
HtmlGenericControljqueryInclude = new HtmlGene ricControl("link"); jqueryInclude. Attributes.Add("href", " Styles/superTables.css"); jqueryInclude. Attributes.Add("rel", " stylesheet"); jqueryInclude. Attributes.Add("type", "text/ css"); Page.Header. Controls.Add(jqueryInclude);
加在</head>的標籤之前
RegisterClientScriptBlock
string scriptContent = "this is your script!!"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "dynamicScript", scriptContent, true);
RegisterStartupScript
string scriptContent = "this is your script!!";
ScriptManager.RegisterStartupScript(this, this.GetType(), "dynamicScript", scriptContent, true);
沒有留言:
張貼留言