2010-09-26 306 views
35

我有简单的应用程序与FormView和SQLDataSource。当我选中“启用动态数据支持”时,出现以下错误:无法确定MetaTable

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.

任何想法?

+0

我遇到了同样的事情。我从来没有看到过这个错误,特别是不知道DynamicDataRoute的含义。据我所知,我并没有使用一个,而更多的是我不知道它需要一个。 – Rod 2010-11-13 00:26:41

回答

0

为了能够使用动态数据,您需要将数据模型添加到项目中,无论是以LINQ to SQL的形式还是实体框架数据模型。

如何做到这一点作为一个例子具体细节是在MSDN上提供here

+0

感谢您的回复,我将列更改为BoundField并且它工作了 – chathura 2013-07-11 08:15:25

81

对于我来说,事实证明,在我的网格视图,列被绑定为一个“ASP:DynamicField”,不作为“ASP:BoundField的”

改变我的专栏从类似这样:

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

这样:

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

固定它;-)

+4

我刚刚自己创建了这个。不知何故,当我去添加一列时,我选择了我想从“DynamicField”列表中选择的列名,而不是“BoundField”列表。感谢您的简单修复! +1 – 2011-03-04 21:44:08

+2

谢谢,布拉德,这解决了我的问题! – 2011-04-03 12:57:44

+1

这也为我解决了同样的问题 - 但仍然,为什么这些字段首先变成“动态字段”?我看不到任何与此相关的网格视图或数据源属性! – Loophole 2013-01-02 01:11:07