Update and Add Data

Pre-Create Blank Rows in Table Control

This customization shows how to pre-create a few blank entries for the child tables.
Table Name
Select the name of the database table
Select a table control
Applies to
TableControl class
''' This method will add three records on the page.
Public IsLoadDataCalled As Boolean = False
Public Overrides Sub LoadData()

    ' Call MyBase.LoadData()

    If Not Me.Page.IsPostBack() AndAlso Not IsLoadDataCalled Then
        IsLoadDataCalled = True
        Dim list As ArrayList
        If (IsNothing(DataSource)) Then
            list = New ArrayList()
            list = New ArrayList(Me.DataSource)
        End If             
        Dim i As Integer
        'This will insert rows at the end of the table control
        For i = 0 To 2
            list.Add(New ${${Table Name}RecordClassName})
        Next i
        'Add the code to insert rows at top of the table control
        ' For i = 0 To 2
            ' list.Insert(i, New ${${Table Name}RecordClassName})
        ' Next i
        Me.DataSource = DirectCast(list.ToArray(GetType(${${Table Name}RecordClassName})), ${${Table Name}RecordClassName}())
    End If
End Sub

Terms of Service Privacy Statement