i have a listview inside listview... how can i f开发者_高级运维ind innerlistview... how can i gets its(innerlistview) edititem index and bind the control...
You need to use the ItemDataBound event of the main ListView, then search the inner control using FindControl(id) and then binding the inner ListView to your desired data source.
Simulating an Order -> Products list:
protected void list_ItemDataBound(object sender, ListViewItemEventArgs e)
{
if (e.Item.ItemType == ListViewItemType.DataItem)
{
ListViewDataItem item = (ListViewDataItem)e.Item;
Order order = (Order)item.DataItem;
ListView innerList = (ListView)item.FindControl("innerListID");
innerList.DataSource = order.Products;
}
}
精彩评论