Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Occurs after the DataRepeaterItem and its controls are cloned from the ItemTemplate.
Namespace: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
public event DataRepeaterItemEventHandler ItemCloned
public:
event DataRepeaterItemEventHandler^ ItemCloned {
void add(DataRepeaterItemEventHandler^ value);
void remove(DataRepeaterItemEventHandler^ value);
}
member ItemCloned : IEvent<DataRepeaterItemEventHandler,
DataRepeaterItemEventArgs>
Public Event ItemCloned As DataRepeaterItemEventHandler
Use this event to fix the display of any controls that are not cloned correctly by the default cloning process. For example, a ListBox control might not be populated with data during cloning; you can populate the list in the ItemCloned event handler.
Note
If you need complete control over the cloning process, use the ItemCloning event instead.
For more information about how to handle events, see Handling and Raising Events.
The following example demonstrates how to repair the Items collection of a ListBox control in the ItemCloned event handler.
private void dataRepeater1_ItemCloned(object sender,
Microsoft.VisualBasic.PowerPacks.DataRepeaterItemEventArgs e)
{
ListBox Source = (ListBox)dataRepeater1.ItemTemplate.Controls["listBox1"];
ListBox listBox1 = (ListBox)e.DataRepeaterItem.Controls["listBox1"];
foreach (string s in Source.Items)
{
listBox1.Items.Add(s);
}
}
Private Sub DataRepeater1_ItemCloned(
ByVal sender As Object,
ByVal e As Microsoft.VisualBasic.PowerPacks.DataRepeaterItemEventArgs
) Handles DataRepeater1.ItemCloned
Dim Source As ListBox =
CType(DataRepeater1.ItemTemplate.Controls.Item("ListBox1"), ListBox)
Dim ListBox1 As ListBox =
CType(e.DataRepeaterItem.Controls.Item("ListBox1"), ListBox)
For Each s As String In Source.Items
ListBox1.Items.Add(s)
Next
End Sub
ItemCloning
DataRepeater Class
Microsoft.VisualBasic.PowerPacks Namespace
Introduction to the DataRepeater Control (Visual Studio)
Return to top