新手学习自定义控件-- 输出HTML标签
2009-08-04 16:17
555 查看
输出HTML 标签有以下几种方式 ~
用HTMLTextWrter 输入
output.AddAttribute(HtmlTextWriterAttribute.Bgcolor, "@6699ff");
output.AddAttribute("bgcolor", "#6699ff");
output.AddAttribute(HtmlTextWriterAttribute.Checked, "true");
output.AddAttribute("checked", "true");
给控件增加样式:
output.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "10");
output.AddStyleAttribute(HtmlTextWriterStyle.Width, "500px");
还可以
output.AddStyleAttribute("Width", "500px");
output.AddStyleAttribute("Height", "500px");
直接输出 HTML
output.Write("<a href='http://www.baidu.com' target='blank' >");
output.Write(this.Width);
output.Write("百度</a>");output.write(this.Width) 当输入的是一个有效的HTMl 标签。就正常输出,如果不是个有效的HTML标签就输入改属性的Text文本
用HTMLTextWrter 输入
output.AddAttribute(HtmlTextWriterAttribute.Bgcolor, "@6699ff");
output.AddAttribute("bgcolor", "#6699ff");
output.AddAttribute(HtmlTextWriterAttribute.Checked, "true");
output.AddAttribute("checked", "true");
给控件增加样式:
output.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "10");
output.AddStyleAttribute(HtmlTextWriterStyle.Width, "500px");
还可以
output.AddStyleAttribute("Width", "500px");
output.AddStyleAttribute("Height", "500px");
直接输出 HTML
output.Write("<a href='http://www.baidu.com' target='blank' >");
output.Write(this.Width);
output.Write("百度</a>");output.write(this.Width) 当输入的是一个有效的HTMl 标签。就正常输出,如果不是个有效的HTML标签就输入改属性的Text文本
相关文章推荐
- web学习—html标签—表单及其控件(三)
- MVC中的自定义标签分页控件,仅供大家学习!!
- [原创]java WEB学习笔记41:简单标签之带属性的自定义标签(输出指定文件,计算并输出两个数的最大值 demo)
- asp.net控件开发技巧(1)使用HtmlTextWriter类规范输出标签
- web学习—html标签—表单及其控件(二)
- asp.net控件开发技巧(1)使用HtmlTextWriter类规范输出标签
- <学习html>第六天笔记-表单标签(input控件、label标签)
- <学习html>第七天笔记-表单标签(textarea控件、下拉菜单、表单域)
- Jquery学习笔记: attr和 prop的区别,以及为html标签自定义属性
- 【AngularJS学习笔记】封装一些简单的控件(封装成Html标签)
- <学习html>第四天笔记-注释标签;相对路径,绝对路径;有序列表,无序列表,自定义列表;总结
- web学习—html标签—表单及其控件(一)
- Android自定义控件之组合控件学习笔记分享
- nodejs 输出 html 标签
- android 自定义ListView下拉刷新控件——自定义控件学习(五)
- 自定义HTML中select控件
- 学习笔记2017.07.03-day1,am-HTML简介-HTML标签-HTML元素
- html 复制标签内文本的按钮的 js 实现【学习过程】【浏览器兼容】
- jeecms学习二-------学习freeMark标签及自定义标签的用法
- html <radio>单选按钮控件标签