我正在构建一个类的网站,并且遇到了一个我找不到解决方案的错误。我在页面上有一个显示切割名称的下拉列表,并将选定的值设置为从sqldatasource(来自访问数据库的数据表 - fig1)(此工作正常,因为我在添加第二个sqldatasource之前测试过)中选择的客户ID。我将一个datalist控件添加到页面,第二个sqldatasource绑定到datalist。我使用配置数据源向导配置了数据源,如fig2.所示,然后我使用向导来测试查询返回的数据并查看它作品中,向导将显示返回我想要的数据所以我绑定在DataList到数据源,现在的ItemTemplate(在HTML源视图)包含的数据绑定标签,将显示该值:在asp项目中从sqldatasource显示数据列表中的数据时出错
Products.Name:
<asp:Label ID="Products_NameLabel" runat="server" Text='<%# Eval("Products.Name") %>' />
<br />
Technicians.Name:
<asp:Label ID="Technicians_NameLabel" runat="server" Text='<%# Eval("Technicians.Name") %>' />
<br />
Incidents.DateOpened:
<asp:Label ID="Incidents_DateOpenedLabel" runat="server" Text='<%# Eval("Incidents.DateOpened") %>' />
<br />
Incidents.DateClosed:
<asp:Label ID="Incidents_DateClosedLabel" runat="server" Text='<%# Eval("Incidents.DateClosed") %>' />
<br />
Incidents.Description:
<asp:Label ID="Incidents_DescriptionLabel" runat="server" Text='<%# Eval("Incidents.Description") %>' />
拉贝尔斯现在被绑定到从第二个源返回的数据....或似乎。当我运行它,并选择客户应返回在SqlDataSource的select语句所选择的数据,我的程序崩溃,并给出了这个错误:
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Products'.
我不明白为什么它是说,DataRowView的呢当我在向导中测试时,sqldatasource明确返回它时,不包含具有该名称的列。任何人都可以帮忙吗?
P.S.对不起imgur的链接...显然你必须有一个更高的代表发布图片
谢谢你的工作! – mac 2013-04-05 01:54:15