收集一些偶然看到的小tips,先列一些在这儿,慢慢补充。
设置title : this.header.title="这是个title测试";
如果用了masterpage可以这样用: this.page.title = sitemap.currentnode.title;
动态设置style:
style style = new style();
style.forecolor = system.drawing.color.navy;
style.backcolor = system.drawing.color.lightgray;
// add the style to the header for the body of the page
this.header.stylesheet.createstylerule(style, null, "body");
动态加样式表: htmllink link = new htmllink();
link.attributes.add("type", "text/css");
link.attributes.add("rel", "stylesheet");
link.attributes.add("href", "~/newstyle.css");
this.header.controls.add(link);
动态加meta tags : // render: <meta name="keywords" content="some words listed here" />
htmlmeta meta = new htmlmeta();
meta.name = "keywords";
meta.content = "some words listed here";
this.header.controls.add(meta);
// render: <meta name="robots" content="noindex" />
meta = new htmlmeta();
meta.name = "robots";
meta.content = "noindex";
this.header.controls.add(meta);
// render: <meta name="date" content="2006-03-25" scheme="yyyy-mm-dd" />
meta = new htmlmeta();
meta.name = "date";
meta.content = datetime.now.tostring("yyyy-mm-dd");
meta.scheme = "yyyy-mm-dd";
this.header.controls.add(meta);
新闻热点
疑难解答
图片精选