Compartir a través de


DataRepeater.NewItemNeeded Event

Occurs when the VirtualMode property is set to True and the user creates a new blank DataRepeaterItem.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

'Declaration
Public Event NewItemNeeded As EventHandler
public event EventHandler NewItemNeeded
public:
 event EventHandler^ NewItemNeeded {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
member NewItemNeeded : IEvent<EventHandler,
    EventArgs>
JScript does not support events.

Remarks

In virtual mode, use this event to add a new record to your data store when the user adds a new item.

When the VirtualMode property is set to False, this event is not raised.

For more information about how to handle events, see Consuming Events.

Examples

The following example demonstrates how to handle the NewItemNeeded event. It assumes that you have a DataRepeater control named DataRepeater1 that has its VirtualMode property set to True, and that you have a data store for a data source named Employees.

Private Sub DataRepeater1_NewItemNeeded(
  ) Handles DataRepeater1.NewItemNeeded

    Dim newEmployee As New Employee
    Employees.Add(newEmployee)
    blnNewItemNeedEventFired = True 
End Sub
private void dataRepeater1_NewItemNeeded(object sender, System.EventArgs e)
{
    Employee newEmployee = new Employee();
    Employees.Add(newEmployee);
    blnNewItemNeedEventFired = true;
}

.NET Framework Security

See Also

Reference

DataRepeater Class

Microsoft.VisualBasic.PowerPacks Namespace

ItemValueNeeded

ItemValuePushed

Other Resources

Introduction to the DataRepeater Control (Visual Studio)

Virtual Mode in the DataRepeater Control (Visual Studio)