1. source file type
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. Assembly Form:
<% @ Register Assembly = "mycontrols" namespace = "mycontrols" tagprefix = "PC3" %>
<PC3: rainbowlabel id = "rainbowlabel1" runat = "server"> </PC3: rainbowlabel>
This. rainbowlabel1.address = X;