zoukankan
html css js c++ java
asp.net控件开发基础(1)
简单的没事件的控件
Code
using
System;
using
System.Collections.Generic;
using
System.Text;
using
System.Web.UI;
using
System.ComponentModel;
namespace
ComponentControl
{
[DefaultProperty(
"
UserName
"
)]
//
默认选择属性
public
class
Ctrl3 : Control
{
private
string
m_UserName;
[Description(
"
登录用户名
"
)]
//
属性描述
public
string
UserName
{
get
{
return
ViewState[
"
UserName
"
]
==
null
?
"
admin
"
: ViewState[
"
UserName
"
].ToString(); }
set
{ m_UserName
=
value; }
}
private
string
m_Password;
[Description(
"
登录密码
"
)]
public
string
Password
{
get
{
return
ViewState[
"
PassWord
"
]
==
null
?
"
admin
"
: ViewState[
"
PassWord
"
].ToString(); }
set
{ m_Password
=
value; }
}
protected
override
void
Render(HtmlTextWriter writer)
{
writer.AddAttribute(HtmlTextWriterAttribute.Border,
"
1px solid #ccc
"
);
writer.RenderBeginTag(HtmlTextWriterTag.Table);
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.Write(
"
UserName :
"
);
writer.RenderEndTag();
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.AddAttribute(HtmlTextWriterAttribute.Type,
"
text
"
);
writer.AddAttribute(HtmlTextWriterAttribute.Value, UserName);
writer.AddAttribute(HtmlTextWriterAttribute.Width,
"
200px
"
);
writer.RenderBeginTag(HtmlTextWriterTag.Input);
writer.RenderEndTag();
writer.RenderEndTag();
writer.RenderEndTag();
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.Write(
"
PassWord :
"
);
writer.RenderEndTag();
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.AddAttribute(HtmlTextWriterAttribute.Type,
"
password
"
);
writer.AddAttribute(HtmlTextWriterAttribute.Width,
"
200px
"
);
writer.AddAttribute(HtmlTextWriterAttribute.Value, Password);
writer.RenderBeginTag(HtmlTextWriterTag.Input);
writer.RenderEndTag();
writer.RenderEndTag();
writer.RenderEndTag();
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.AddAttribute(HtmlTextWriterAttribute.Colspan,
"
2
"
);
writer.AddAttribute(HtmlTextWriterAttribute.Align,
"
center
"
);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.AddAttribute(HtmlTextWriterAttribute.Type,
"
button
"
);
writer.AddAttribute(HtmlTextWriterAttribute.Value,
"
Test
"
);
writer.RenderBeginTag(HtmlTextWriterTag.Input);
writer.RenderEndTag();
writer.RenderEndTag();
writer.RenderEndTag();
writer.RenderEndTag();
//
base.Render(writer);
}
}
}
,
这个送给你!
查看全文
相关阅读:
this指向问题
b继承a的函数
如何解决跨域问题
事件冒泡和阻止事件冒泡
Spring5(二)——IOC
MySQL基础(四)——
MySQL基础(二)——常用命令
MySQL基础(一)——入门
Linux(二)——常用命令
Linux(一)——简介
原文地址:https://www.cnblogs.com/di305449473/p/1245323.html
最新文章
(Java学习笔记) Java Networking (Java 网络)
(Java学习笔记) Java Threading (Java线程)
Java学习笔记(3)
Java学习笔记(2)
Java学习笔记(1)
JS高级语法与JS选择器
CSS布局总结及实际应用中产生的问题
JavaScrpt简单介绍
CSS形变与动画
CSS高级布局
热门文章
CSS 常用语法与盒模型分析
HTML语法分析
【转载】前端知识体系大全
面向对象之(非)绑定方法,反射,isinstance与issubclass
Ajax的工作原理
请简述HTML和XHTML最重要的4点不同?
原生查找DOM的方法
冒泡排序
Generator函数
es6数组新特性
Copyright © 2011-2022 走看看