I put this as a datasource in my gridView
var source = from p in allComments
select new {p.Img, p.Name, p.Comment};
GridView1.DataSource = source;
GridView1.DataBind();
and i get this:
The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource.
A control with ID 'SqlDataSource1' could not be found.
My Gridview Markup:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
style="z-index: 1; left: 317px; top: 374px; position: absolute; height: 597px; width: 666px"
BackColor="#CCCCCC" BorderColor="#999999"
BorderWidth="0px" CellPadding="4" CellSpacing="2"
DataSourceID="SqlDataSource1" ForeColor="Black" AllowPaging="True"
onrowdatabound="GridView1_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="#">
<HeaderStyle Width="500px" />
<ItemStyle Width="500px" />
<ItemTemplate>
<asp:Label ID="lblMessage" runat="server" Text='<%# Bind("Comment") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="#">
<HeaderStyle Width="100px" />
<ItemStyle Width="100px" />
<ItemTemplate>
<asp:Image ID="imgName" runat="server" imageUrl='<%# Bind("Img") %>'></asp:Image><br />
<asp:Hyperlink ID="hyperLink" runat="server" Text='<%# Bind("Name") %>' ></asp:Hyperlink>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>