I am trying to create an asp.net table with a repeater. Here is my code for creating the table:
<table class="pageViewTable" align="centre" border="1">
<tr bgcolor="green">
<th>DateTime</th>
<th>Page</th>
<th>Location</th>
<th>IP Address</th>
</tr>
<asp:Repeater ID="TableRepeater" runat="server" >
<ItemTemplate>
<tr>
<td><%#Container.DataItem("dateTime")%></td>
<td><%#Container.DataItem("Page")%></td>
<td>::LOCATION</td>
<td><%#Container.DataItem("IPAddress")%></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
I have seen many other examples of how to create a repeater in a table but this is the only one that will actually get the page to load.
I then create an arraylist of the class:
public class pageViews
{
public string dateTime {get; set;}
public string IPAddress {get; set;}
public string Page {get; set;}
public string Location {get; set;}
}
and populate it. Next I try to bind the arrylist to the table by:
TableRepeater.Datasource = pviews;
TableRepeater.Databind();
Where:
List <pageViews> pviews = new List<pageViews>();
But I get the following error:
CS1061: 'System.Web.UI.WebControls.Repeater' does not contain a definition for 'Datasource' and no extension method 'Datasource' accepting a first argument of type 'System.Web.UI.WebControls.Repeater' could be found (are you missing a using directive or an assembly reference?)
Here are all my namespaces in the project:
using System;
using System.Web.Configuration;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
I suspect I have a number of errors, but I am not sure what they are.
I have tried numerous tutorials, but cannot seem to get any to work. I am coding in notepad++ please do not suggest to use VS I am trying to learn how to do this with intellisense.