我在ItemTemplate中创建了一个带有WebDataGrid的Infrastics WebDropDown。问题是,在后面的代码中,它说wddAddresses没有控件,也没有任何模板,ItemTemplate为null。如何在代码后面"找到"WebDataGrid?控件的标记如下。
谢谢,Dan
<ig:WebDropDown
ID="wddAddresses"
runat="server"
Width="200px"
DropDownContainerWidth="500px"
ClientEvents-ValueChanging="wddAddresses_ValueChanging">
<DropDownItemBinding TextField="city" ValueField="addressID" />
<ItemTemplate>
<ig:WebDataGrid ID="gridAddresses" runat="server" AutoGenerateColumns="False"
Height="350px" Width="400px" >
<Columns>
<ig:BoundDataField
DataFieldName="street1"
Key="street1">
<Header Text="Street" />
</ig:BoundDataField>
</Columns>
<Behaviors>
<ig:Selection
CellClickAction="Row"
RowSelectType="Single"
SelectionClientEvents-RowSelectionChanged="gridAddresses_RowSelectionChanged">
</ig:Selection>
</Behaviors>
</ig:WebDataGrid>
</ItemTemplate>
</ig:WebDropDown>
答案:来自Infrasgistics支持部门的Petar。
模板控件可以通过WebDropDown的项目访问。以下示例;
(WebDropDown1.Items[0].FindControl("Button1") as Button).Text = "new text";