在ASP.NET中为用户控件使用控件适配器
我们可以使用控件适配器更改ASP.NET控件的输出呈现。现在我想知道,是否可以通过ASP.NET中的控件适配器更改用户控件呈现?顺便说一句,我的页面中有几个用户控件,我不想对它们执行相同的操作。可以,但必须在用户控件中将控件子项定义为公共在ASP.NET中为用户控件使用控件适配器,asp.net,user-controls,rendering,Asp.net,User Controls,Rendering,我们可以使用控件适配器更改ASP.NET控件的输出呈现。现在我想知道,是否可以通过ASP.NET中的控件适配器更改用户控件呈现?顺便说一句,我的页面中有几个用户控件,我不想对它们执行相同的操作。可以,但必须在用户控件中将控件子项定义为公共 (Associate public on child controls in order to access from your adapter) public class UserControlSample : userControl { public
(Associate public on child controls in order to access from your adapter)
public class UserControlSample : userControl
{
public TextBox TextBoxWrapper
{
get
{
return MyTextBox;
}
set
{
MyTextBox = value;
}
}
}
//Access from adapter
UserControlSample.TextBoxWrapper.Text
UserControlSample.TextBoxWrapper.Id
.....
如何访问适配器中的子控件?