如何覆盖GridView OnItemDatabound方法



我想创建服装Gridview。我发现开源非常好,但问题是它使用DataGrid,当我将继承类更改为GridView时,我会得到以下错误

aadgridview.onitemdatabound(datagriditemeventargs) e):发现替代的方法

我在这里覆盖:

//public class AADGridView : DataGrid, IPostBackEventHandler
         public class AADGridView : GridView, IPostBackEventHandler
        {
            /// <summary>
            /// Gets or sets a value that indicates whether the auto filter is displayed in the AADGrid.AADGridControl.
            /// </summary>
            [Bindable(true), Category("Appearance"), Description("Whether to show the control's auto filter."), DefaultValue(true),]

            /// <summary>
            /// Override the DataGrid constructor.
            /// </summary>
            public AADGridView() : base()
            {
                // create the ArrayList to contain the DropDownList controls and the SortedList objects added to the header items;
                //list = new ArrayList();
                sort = new ArrayList();
                filter = true;
            }
            /// <summary>
            /// Override the OnItemDataBound event.
            /// </summary>
            /// <param name="e"></param>
            override protected void OnItemDataBound(DataGridItemEventArgs e)
            {
              //Some Code
               base.OnItemDataBound(e);
            }

如您在代码中看到的,我只是将DataGrid更改为GridView。他们俩都有OnitemDatabound,那问题是什么?谢谢

事件参数为DataGridItemEventArgs类型。您必须将参数类型更改为新的Base类参数。

最新更新