DataRepeaterItemValueEventArgs Class

 

Provides data for the ItemValueNeeded and ItemValuePushed events.

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

System.Object
  System.EventArgs
    Microsoft.VisualBasic.PowerPacks.DataRepeaterItemValueEventArgs

public class DataRepeaterItemValueEventArgs : EventArgs

NameDescription
System_CAPS_pubmethodDataRepeaterItemValueEventArgs(Int32, Control, String, Object)

Initializes a new instance of the DataRepeaterItemValueEventArgs class.

NameDescription
System_CAPS_pubpropertyControl

Gets the child control of a DataRepeaterItem that is raising the ItemValueNeeded or ItemValuePushed event.

System_CAPS_pubpropertyItemIndex

Gets the index of the DataRepeaterItem that contains the control that is raising the ItemValueNeeded or ItemValuePushed event.

System_CAPS_pubpropertyPropertyName

Gets the name of the data-bound property of the control that is raising a ItemValueNeeded or ItemValuePushed event.

System_CAPS_pubpropertyValue

Gets the property value that has changed to raise a ItemValueNeeded or ItemValuePushed event.

NameDescription
System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

In virtual mode, use the ItemValueNeeded event to populate the child controls of the ItemTemplate with values from your data store when a DataRepeaterItem is displayed or when a new item is added.

Use the ItemValuePushed event to save changes to the child control values to your data store.

When the VirtualMode property is set to False, these events are not raised.

The following example demonstrates how to handle the ItemValueNeeded event. It assumes that you have a DataRepeater control named DataRepeater1 that has its VirtualMode property set to True. The code will resemble the following example, which is for a data source named Employees.

private void dataRepeater1_ItemValueNeeded(object sender, Microsoft.VisualBasic.PowerPacks.DataRepeaterItemValueEventArgs e)
{
    if (e.ItemIndex < Employees.Count)
    {
        switch (e.Control.Name)
        {
            case "txtFirstName":
                e.Value = Employees[e.ItemIndex + 1].firstName;
                break;
            case "txtLastName":
                e.Value = Employees[e.ItemIndex + 1].lastName;
                break;
        }
    }
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: