ASP.NET中继器不包含中继器的定义

ASP.NET repeater does not contain a definition for repeater

我正在尝试用中继器创建一个 asp.net table。这是我创建 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> 

我已经看到许多关于如何在 table 中创建转发器的其他示例,但这是唯一一个实际加载页面的示例。

然后我创建一个 class:

的数组列表
public class pageViews
    {
        public string dateTime {get; set;}
        public string IPAddress {get; set;}
        public string Page {get; set;}
        public string Location {get; set;}
    }

并填充它。接下来我尝试通过以下方式将 arrylist 绑定到 table:

    TableRepeater.Datasource = pviews;
    TableRepeater.Databind();

其中:

List <pageViews> pviews = new List<pageViews>();

但我收到以下错误:

 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?)

以下是我在项目中的所有命名空间:

using System;
using System.Web.Configuration; 
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;

我怀疑我有一些错误,但我不确定它们是什么。

我尝试了很多教程,但似乎无法正常工作。我正在用记事本++编写代码,请不要建议使用 VS 我正在尝试学习如何使用智能感知来做到这一点。

DataSource,不是Datasource

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.

首先,您需要全面阅读它们。我怀疑这些 "numerous tutorials" 是否会将您指向 Repeater 的 Datasource 属性...

另一方面,您说不建议Visual Studio。 Visual Studio不仅仅是一个代码编辑器,而是一个完整的集成开发环境(IDE),我无法想象你要付出额外的努力来手动编译一个ASP.NET 应用程序,部署它,... 如果是 .NET 解决方案,Visual Studio 就足够完美了:使用 SublimeText、Notepad++ 或任何其他代码编辑器之类的东西没有任何优势,因为你丢失了很多 . NET 特定的代码编辑功能。 一个是实时代码错误报告,它会给你 DataSource 而不是 Datasource.

大多数 .NET 开发人员不会来问答网站询问拼写错误的 class、属性、方法或其他内容,因为 Visual Studio 会提前警告您而且你的工作效率会更高!

此外,还有 Visual C# Express、Visual Web Express,现在 Visual Studio 社区(完全免费)...Notepad++ 在开发 C#、.NET 和 [= Windows.

中的 31=] 个解决方案

C# 区分大小写,因此它应该是 DataSource