我正在尝试将外键表数据字段分配给 gridview。它抛出错误。
在所选数据源中找不到名为“Dim_Hierarchy.Business_Unit_Name”的字段或属性。
代码背后
Public Function GetInitiativeDataList(ByVal client_Idx As Integer) As List(Of Fact_Initiative)
Dim fact_Initiative As IList(Of Fact_Initiative)
Dim SGAEntities As New SGATLEntities()
fact_Initiative = (From factInitiative In SGAEntities.Fact_Initiative Where factInitiative.Client_Idx = client_Idx).ToList()
Return fact_Initiative
End Function
ASPX 页面
<asp:GridView ID="gvInitiavtives" runat="server" Width="100%" CssClass="Grid"
RowStyle-Width="30px" AutoGenerateColumns="false" HeaderStyle-CssClass="GridHeader" RowStyle-CssClass="GridItem" AlternatingRowStyle-CssClass="GridAltItem">
<Columns>
<asp:BoundField DataField="Dim_Hierarchy.Business_Unit_Name" HeaderText="" HeaderStyle-Wrap="false" HeaderStyle-HorizontalAlign="NotSet" />
<asp:BoundField DataField="Dim_Hierarchy.Business_Unit_Function" HeaderText="" HeaderStyle-Wrap="false" HeaderStyle-HorizontalAlign="NotSet" />
......
......
我是否以正确的方式做事?