如何从代码隐藏中设置ListView
的LayoutTemplate
中的用户控件属性?如何访问listview的layouttemplate中的控件?
<asp:ListView ...>
<LayoutTemplate>
<myprefix:MyControl id="myControl" ... />
</LayoutTemplate>
...
</asp:ListView>
我想这样做:
myControl.SomeProperty = somevalue;
请注意,我的控制是不是在ItemTemplate
,它是在LayoutTemplate
,所以它并不适用于所有项目的存在,只存在一次。所以我应该可以访问一次,而不是每个数据绑定的项目。