使用动态数据过滤时出错:缺少数据源
我正在尝试使用 ASP.NET 动态数据过滤项目,但我在运行期间遇到了问题配置。
我按照作者博客上的说明进行操作,一切都按描述进行。然后它告诉我使用设计器视图更改数据源。我被告知在“配置数据源”向导中选择“GridDataSource”。但这个选项不存在。
我获取了项目中的所有类,包括 Linq 生成的 DataContext。当我选择“仅显示 DataContext 对象”时,下拉列表(“选择您的上下文对象:”)完全是空的。
当我关闭复选框并选择 DataContext 类时,系统会询问我想要哪个表等等。但是,由于动态数据站点的全部目的不是使用单个表,因此这没有多大帮助。
因此,我再次查看了说明,并从示例中复制了生成的数据源:
<asp:DynamicLinqDataSource ID="GridDataSource" runat="server"
EnableDelete="True" EnableUpdate="True"></asp:DynamicLinqDataSource>
这正是我所拥有的,其中没有“WhereParameters”节点。
但是现在,当我运行列表页面时,我收到有关过滤组件缺少数据源的异常。当然,当我删除 DynamicFilterRepeater 时,它会再次工作。
这是异常的核心:
[InvalidOperationException:缺少数据源] D:\Catalyst\Projects\DynamicData\Project\Trunk\DynamicData\DynamicData\DynamicFilterRepeater.cs 中的 Catalyst.Web.DynamicData.DynamicFilterRepeater.GetTable():74 D:\Catalyst\Projects\DynamicData\Project\Trunk\DynamicData\DynamicData\DynamicFilterRepeater.cs 中的 Catalyst.Web.DynamicData.DynamicFilterRepeater.GetFilters():81 D:\Catalyst\Projects\DynamicData\Project\Trunk\DynamicData\DynamicData\DynamicFilterRepeater.cs 中的 Catalyst.Web.DynamicData.DynamicFilterRepeater.OnInit(EventArgs e):106
如何使 DynamicFilterRepeater 识别我的数据源?
我在Win7机器上使用VS2010 Pro。
I am trying to use the ASP.NET Dynamic Data Filtering project, but I'm running into a problem during the configuration.
I'm following the instructions on the author's blog, and everything works like described. Then it tells me to change the datasource using the designer view. I am told to select the "GridDataSource" in the "Configure data source" wizard. This option is not there though.
I get all of the classes in my project, including the DataContext that was generated by Linq. When I choose "Show only DataContext objects", the dropdown ("Choose your context object:") is completely empty.
When I turn of the checkbox and choose my DataContext class, I get asked which table I want and all that. But, as the whole purpose of a Dynamic Data site is NOT to use one single table, that's not much help.
So I've looked at the instructions again and copied the resulting datasource from the example:
<asp:DynamicLinqDataSource ID="GridDataSource" runat="server"
EnableDelete="True" EnableUpdate="True"></asp:DynamicLinqDataSource>
Which is exactly what I had, without the "WhereParameters" nodes in there.
Now, when I run the list page however, I get an exception about a missing datasource from the filtering component. Of course when I remove the DynamicFilterRepeater, it works again.
This is the meat of the exception:
[InvalidOperationException: Missing DataSource]
Catalyst.Web.DynamicData.DynamicFilterRepeater.GetTable() in D:\Catalyst\Projects\DynamicData\Project\Trunk\DynamicData\DynamicData\DynamicFilterRepeater.cs:74
Catalyst.Web.DynamicData.DynamicFilterRepeater.GetFilters() in D:\Catalyst\Projects\DynamicData\Project\Trunk\DynamicData\DynamicData\DynamicFilterRepeater.cs:81
Catalyst.Web.DynamicData.DynamicFilterRepeater.OnInit(EventArgs e) in D:\Catalyst\Projects\DynamicData\Project\Trunk\DynamicData\DynamicData\DynamicFilterRepeater.cs:106
How do I make the DynamicFilterRepeater recognize my datasource?
I'm using VS2010 Pro, on a Win7 machine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否看过下载源代码时获得的示例项目?
在这里查看我的博客文章 动态数据过滤 – 安装< /a>
have you looked at the sample project you get when you download the source code.
Have a look at my blog post here Dynamic Data Filtering – Installation