In these cases, developers should code the necessary initialization in the .NET script and then enable "Run .NET AfterOpen event on sync" on the server for the appropriate form template. This will run the .NET's AfterOpen event on the server when the form template is synced.
It looks like this on the server under a template.
If _Grid.Value Is Nothing Then Dim dt As New DataTable() Dim dc As DataColumn dc = New DataColumn("Column1") dt.Columns.Add(dc) dc = New DataColumn("Column2") dt.Columns.Add(dc) dc = New DataColumn("Column3") dt.Columns.Add(dc) dc = New DataColumn("Column4") dt.Columns.Add(dc) _Grid.Value = dt End If
Other examples include needing the form to have prepopulated data from a database or file (csv, xml, etc) that is on the server. The form can be scripted to download data from various sources in the .NET AfterOpen event. By scripting it here, the form can access files that are on the server, and not the local machine.