UserControls使用总结
2008-09-22 08:24
211 查看
1. 源文件型
WebUserControl.ascx
public AddressInfo Address
{
set
{
if (value != null)
{
if (!string.IsNullOrEmpty(value.Id))
id.Text = value.Id;
if (!string.IsNullOrEmpty(value.Name))
name.Text = value.Name;
}
}
}
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:Literal ID="id" runat="server"></asp:Literal>
<asp:Literal ID="name" runat="server"></asp:Literal><br/>
</td>
</tr>
</table>
Default.aspx
.html
<%@ Register src="UserControls/WebUserControl.ascx" tagname="ddd" tagprefix="uc1" %>
<uc1:ddd id="fff" runat="server"></uc1:ddd>
AddressInfo x = new AddressInfo("asdfa", "asdfa");
this.fff.Address = x;
2. 程序集形式:
<%@ Register assembly="myControls" namespace="myControls" tagprefix="cc1" %>
<cc1:RainbowLabel ID="RainbowLabel1" runat="server"></cc1:RainbowLabel>
this. RainbowLabel1.Address = x;
WebUserControl.ascx
public AddressInfo Address
{
set
{
if (value != null)
{
if (!string.IsNullOrEmpty(value.Id))
id.Text = value.Id;
if (!string.IsNullOrEmpty(value.Name))
name.Text = value.Name;
}
}
}
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:Literal ID="id" runat="server"></asp:Literal>
<asp:Literal ID="name" runat="server"></asp:Literal><br/>
</td>
</tr>
</table>
Default.aspx
.html
<%@ Register src="UserControls/WebUserControl.ascx" tagname="ddd" tagprefix="uc1" %>
<uc1:ddd id="fff" runat="server"></uc1:ddd>
AddressInfo x = new AddressInfo("asdfa", "asdfa");
this.fff.Address = x;
2. 程序集形式:
<%@ Register assembly="myControls" namespace="myControls" tagprefix="cc1" %>
<cc1:RainbowLabel ID="RainbowLabel1" runat="server"></cc1:RainbowLabel>
this. RainbowLabel1.Address = x;
相关文章推荐
- C#--工作笔记(时间单个控件UserControls和使用)
- 总结linux下使用mysql数据库出现 “Access denied for user 'root'@'localhost' (using password: YES)”
- UserData使用总结[转载-lanyu]
- UserData使用总结
- 界面代码使用总结
- java基础总结七(自定义类型&方法&集合混合使用)
- JavaMail IMAP 和JavaMail Pop3 简介以及使用过程遇到的问题总结
- JavaWeb学习总结(五十三)——Web应用中使用JavaMail发送邮件
- Android使用Application总结
- laravel 中使用ajax和vue总结
- 使用split()遇到的问题和方法总结 ( Dangling meta character 和 多个分隔字符)
- 使用MySQL Workbench进行数据库设计——MySQL Workbench使用方法总结
- MyEclipse使用总结——设置MyEclipse开发项目时使用的JDK
- Vim使用总结
- 引用 Geoprocessing调用ArcToolBox工具使用总结
- [Windows Mobile]使用 AlphaMobileControls 實現透明控制項
- vc中edit控件使用总结
- C#Chart控件使用总结
- 【.Net码农】Linq中GroupBy方法的使用总结
- maven使用总结