Again, much thanks :)
Here is the VB code I came up with, placed it in the App_Code folder called ListDataSource.vb
1 Imports Microsoft.VisualBasic
2 Imports System.Web
3 Imports System.Web.UI
4 Imports System.Web.DynamicData
5 Imports System.Collections.Generic
6
7
8 Public Class ListDataSource
9 Implements IAutoFieldGenerator
10
11 Protected table As MetaTable
12
13 Public Function GenerateFields(ByVal control As Control) As ICollection
14 Dim oFields = New List(Of DynamicField)
15 For Each col As MetaColumn In table.Columns
16 If col.IsRequired Then
17 Dim oDF As New DynamicField
18 oDF.DataField = col.Name
19 oFields.Add(oDF)
20 End If
21 Next
22 Return oFields
23 End Function
24
25 End Class
In the actual list page, I am implementing the new class this way.
Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
DynamicDataManager1.RegisterControl(GridView1)
ListDataSource.GenerateFields(GridView1)
End Sub And this is the error message I get which makes no sense to me. Everything appears to be correct.
Compiler Error Message: BC30149:
Class 'ListDataSource' must implement 'Function GenerateFields(control
As Control) As Collections.ICollection' for interface
'System.Web.UI.IAutoFieldGenerator'.