cssファイルとjavascriptファイルを埋め込む方法
1380 ワード
[assembly: WebResource("Erp.Web.WebControls.DatePicker.Resources.DatePicker.js", "application/x-javascript", PerformSubstitution = true)]
[assembly: WebResource("Erp.Web.WebControls.DatePicker.Resources.DatePicker.css", "text/css", PerformSubstitution = true)]
リソースファイル
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
this.Page.ClientScript.RegisterClientScriptInclude("DatePicker.js", this.ResolveClientUrl("~/WebControls/DatePicker/Resources/DatePicker.js"));
HtmlLink link = new HtmlLink();
link.Href = "~/WebControls/DatePicker/Resources/DatePicker.css";
link.Attributes.Add("rel", "stylesheet");
link.Attributes.Add("type", "text/css");
Page.Header.Controls.Add(link);
}
スクリプトファイル:
this.Page.ClientScript.RegisterClientScriptInclude("ext-base.js", this.ResolveClientUrl("~/Admin/ExtJS/adapter/ext/ext-base.js"));
this.Page.ClientScript.RegisterClientScriptInclude("ext-all.js", this.ResolveClientUrl("~/Admin/ExtJS/ext-all.js"));
もちろん対応フォルダの下にはDatePickerが必ずあります.cssとDatePicker.js