I have simple application with FormView and SQLDataSource. When I check "Enable dynamic data support"开发者_Go百科 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?
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 ;-)
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
精彩评论