I have this code in my .aspx page:
But when I run it, i get this CS1061 error: 'Northwind.SuppliersRow' does not contain a definition for 'GetProducts' and no extension method 'GetProducts' accepting a first argument of type 'Northwind.SuppliersRow' could be found (are you missing a using directive or an assembly reference?)'Code:<asp:TemplateField HeaderText="Products"> <ItemTemplate> <asp:BulletedList ID="BulletedList1" runat="server" DataSource='<%# ((Northwind.SuppliersRow)((System.Data.DataRowView)e.Row.DataItem).Row).GetProducts() %>' DataTextField="ProductName"> </asp:BulletedList> </ItemTemplate> </asp:TemplateField>
Weird thing is, I have this code in the code-behind, which works and compiles fine:
Any ideas?Code:protected void GridView_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ((Northwind.SuppliersRow)((System.Data.DataRowView)e.Row.DataItem).Row).GetProducts(); } }




Reply With Quote