Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not determine a MetaTable

Tags:

c#

asp.net

I have simple application with FormView and SQLDataSource. When I check "Enable dynamic data support" I get following error:

Could not determine a MetaTable. A MetaTable could not be determined for 

the data source 'SqlDataSource1' and one could not be inferred from the request URL. Make sure that the table is mapped to the dats source, or that the data source is configured with a valid context type and table name, or that the request is part of a registered DynamicDataRoute.

Any ideas?

like image 806
markoniuss Avatar asked Sep 26 '10 11:09

markoniuss


2 Answers

For me, it turns out that in my grid view, the columns were bound as an "asp:DynamicField", not as a "asp:BoundField"

ie

changing my columns from something like so:

<Columns>   <asp:DynamicField DataField="Id" HeaderText="Id" /> </Columns> 

to this:

<Columns>   <asp:BoundField DataField="Id" HeaderText="Id" /> </Columns> 

fixed it ;-)

like image 97
Brad Parks Avatar answered Oct 13 '22 21:10

Brad Parks


To be able to use Dynamic Data you need to add a Data Model to your project, either in the form of LINQ to SQL or an Entity Framework data model.

Exact details on how to do this as an example is available on MSDN here

like image 42
BinaryMisfit Avatar answered Oct 13 '22 22:10

BinaryMisfit