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 rows in the table control
public Boolean IsLoadDataCalled = false;
public override void LoadData()
    // Call base.LoadData()
    if (!this.Page.IsPostBack && !IsLoadDataCalled) 
        IsLoadDataCalled = true;
        ArrayList list;
        if ((DataSource == null))
            list = new ArrayList();
            list = new ArrayList(this.DataSource);        

        int i;
        for (i = 0; i < 3; i++)
            // To insert rows at the end of the table control
            list.Add(new ${${Table Name}RecordClassName}());  

            // To insert rows at the top of the table control
            // list.Insert(i, new ${${Table Name}RecordClassName}());               
        this.DataSource = (${${Table Name}RecordClassName}[])(list.ToArray(typeof(${${Table Name}RecordClassName})));

Terms of Service Privacy Statement