MobileForms Toolkit Documentation

AdvancedList.RowSelect Event

Occurs when the row in the control is selected or deselected. by click or by setting the SelectedRow property.

public event RowEventHandler RowSelect;

Remarks

Occurs when the row in the control is selected by click or by setting the SelectedRow property. When SelectionMode is set to SelectionMode.SelectDeselect, the RowSelect event is fired also when deselecting the row by click. RowSelect event is not fired, when deselecting the row automatically, when MultiSelect is false. RowSelect is not fired, when using the Selected property of the row.

RowSelect event has arguments of type RowEventArgs.

Example

RowSelect event is used to load or unload the child detail rows for the selected/deselected parent row:

[Visual Basic]

Private Sub AdvancedList1_RowSelect(ByVal sender As Object, ByVal e As Resco.Controls.RowEventArgs)_
 Handles AdvancedList1.RowSelect

    ' we handle the RowSelect event, which is fired at selection/deselection 
    ' (in case of SelectionMode.SelectDeselect) of the row

    Cursor.Current = Cursors.WaitCursor

    Select Case e.DataRow.CurrentTemplateIndex
        Case 1 ' The master row has to be collapsed
            RemoveDetails(e.RowIndex)

        Case 2 ' The master row has to be expanded
            InsertDetails(e.RowIndex, e.DataRow("OrderID"))

            'Otherwise the detail row was (de)selected, do nothing
    End Select

    Cursor.Current = Cursors.Default

End Sub

            
[C#]

private void advancedList1_RowSelect(object sender, Resco.Controls.RowEventArgs e)
{
    // we handle the RowSelect event, which is fired at selection/deselection 
    // (in case of SelectionMode.SelectDeselect) of the row

    Cursor.Current = Cursors.WaitCursor;

    // We use CurrentTemplateIndex to determine the action
    switch (e.DataRow.CurrentTemplateIndex)
    {
        case 1: // The master row has to be collapsed
            RemoveDetails(e.RowIndex);
            break;

        case 2: // The master row has to be expanded
            InsertDetails(e.RowIndex, (int) e.DataRow["OrderID"]);
            break;

        default: // The detail row was (de)selected, do nothing
            break;
    }

    Cursor.Current = Cursors.Default;
}

            

See Also

AdvancedList Class | Resco.Controls.AdvancedList Namespace