Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/324.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 通过添加按钮来扩展中继器_C#_Asp.net_.net - Fatal编程技术网

C# 通过添加按钮来扩展中继器

C# 通过添加按钮来扩展中继器,c#,asp.net,.net,C#,Asp.net,.net,我正在尝试在asp.net中扩展转发器控件。例如,我想添加一个按钮,将控件中R文本的颜色从黑色更改为红色(这只是一个示例) 我创建了web用户控件,并从 public partial class MyRepeater : System.Web.UI.UserControl 致: ascx: 如何用一个按钮轻松地扩展中继器(我需要扩展,因为在实际示例中,这个按钮会做其他事情,所以其他改变颜色的解决方案对我没有帮助) 感谢您提供的任何提示编辑:发现错误并不是我最初认为的 您正在将UserContr

我正在尝试在asp.net中扩展转发器控件。例如,我想添加一个按钮,将控件中R文本的颜色从黑色更改为红色(这只是一个示例)

我创建了web用户控件,并从

public partial class MyRepeater : System.Web.UI.UserControl
致:

ascx:

如何用一个按钮轻松地扩展中继器(我需要扩展,因为在实际示例中,这个按钮会做其他事情,所以其他改变颜色的解决方案对我没有帮助)


感谢您提供的任何提示编辑:发现错误并不是我最初认为的

您正在将UserControl更改为服务器控件扩展,因此

extends the correct base class (e.g. Page or UserControl <---- Note by extending Repeater you now no longer extend UserControl)

扩展了正确的基类(例如更改了Page或UserControl以反映错误@gruber并添加了您需要查看的内容),这可能会为您提供一个扩展repeater的快速服务器控件,但我认为通过阅读MSDN中的文章,您会获得更多
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyRepeater.ascx.cs" Inherits="System.Web.UI.WebControls.Repeater" %>
ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
extends the correct base class (e.g. Page or UserControl <---- Note by extending Repeater you now no longer extend UserControl)