MobileForms Toolkit Documentation

AdvancedList.HeaderClick Event

Occurs when the cell in the header row of the control is clicked.

public event CellEventHandler HeaderClick;

Remarks

HeaderClick event has arguments of type CellEventArgs.

Example

HeaderClick event can be used e.g. for sorting the rows. Simple example:

[Visual Basic]

Private Sub AdvancedList1_HeaderClick(ByVal sender As Object, _
        ByVal e As Resco.Controls.CellEventArgs) Handles AdvancedList1.HeaderClick
    Dim orderBy As String

    Select Case e.CellIndex
        Case 0 ' Sort ascending
            orderBy = " ORDER BY name ASC"
        Case 1 ' Sort descending
            orderBy = " ORDER BY name DESC"
    End Select

    If Not orderBy Is Nothing Then
        ' Update command text and reload the data
        AdvancedList1.DbConnector.CommandText = "SELECT * FROM customers" & orderBy
        AdvancedList1.Reload()
    End If
End Sub
            
[C#]

private void advancedList1_HeaderClick(object sender, Resco.Controls.CellEventArgs e)
{
    string orderBy = null;
    if (e.CellIndex == 0)
        orderBy = " ORDER BY name ASC";
    else if (e.CellIndex == 1)
        orderBy = " ORDER BY name DESC";
    if (orderBy != null)
    {
        // Update command text and reload the data
        advancedList1.DbConnector.CommandText = "SELECT * FROM customers" + orderBy;
        advancedList1.Reload();
    }
}
            

See Also

AdvancedList Class | Resco.Controls.AdvancedList Namespace