Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在ASP.NET中为用户控件使用控件适配器_Asp.net_User Controls_Rendering - Fatal编程技术网

在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

我们可以使用控件适配器更改ASP.NET控件的输出呈现。现在我想知道,是否可以通过ASP.NET中的控件适配器更改用户控件呈现?顺便说一句,我的页面中有几个用户控件,我不想对它们执行相同的操作。

可以,但必须在用户控件中将控件子项定义为公共

(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
..... 

如何访问适配器中的子控件?