[英]ASP.NET repeater does not contain a definition for repeater
我正在尝试使用转发器创建一个asp.net表。 这是我创建表的代码:
<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>
我已经看到了许多其他有关如何在表中创建转发器的示例,但这是唯一可以实际加载页面的示例。
然后,我创建该类的arraylist:
public class pageViews
{
public string dateTime {get; set;}
public string IPAddress {get; set;}
public string Page {get; set;}
public string Location {get; set;}
}
并填充它。 接下来,我尝试通过以下方式将arrylist绑定到表:
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;
我怀疑我有很多错误,但是我不确定它们是什么。
我尝试了许多教程,但似乎无济于事。 我正在用notepad ++进行编码,请不要建议使用VS。我正在尝试学习如何使用智能感知。
它是DataSource
,而不是Datasource
。
我尝试了许多教程,但似乎无济于事。 我正在用notepad ++进行编码,请不要建议使用VS。我正在尝试学习如何使用智能感知。
首先,您需要全面阅读它们。 我怀疑这些“大量教程”是否会将您指向Repeater的Datasource
属性...
另一方面,您说不建议使用Visual Studio 。 Visual Studio不仅仅是一个代码编辑器,而是一个完整的集成开发环境(IDE),而且我无法想象您将付出额外的努力来手动编译ASP.NET应用程序,对其进行部署,..在.NET解决方案的情况下,Visual Studio足够且完美:使用SublimeText,Notepad ++或任何其他代码编辑器之类没有优势,因为您失去了许多.NET特定的代码编辑功能。 一种是实时代码错误报告,它将为您提供DataSource
而不是Datasource
。
大多数.NET开发人员不会到问答站点来询问拼写错误的类,属性,方法之类的东西,因为Visual Studio会提前警告您,您将因此而变得更加高效!
此外,还有Visual C#Express,Visual Web Express,现在是Visual Studio社区(所有功能都是完全免费的)...在Windows中开发C#、. NET和ASP.NET解决方案时,Notepad ++只是浪费时间。
C#区分大小写,因此应该是DataSource
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.