实现接口的麻烦

trouble implementing Interface

我想使用接口在 Class2(和其他)类 中执行 ShowControls() 方法。 Show Controls() 方法包含一个开关语句,它根据 GridView 数据绑定期间的行索引确定在 GridView 的项目模板中显示或隐藏各种控件(其中许多是自定义用户控件)。当我从 Class2 调用该方法时,我收到此错误消息:CS1503 参数 1:无法从 'System.EventArgs' 转换为 'System.Web.UI.WebControls.GridViewRowEventArgs'。这让我很困惑,因为我在方法中明确指定了参数 GridViewRowEventArgs

有人可以帮我正确设置吗?也许我不能在界面中引用 Web 控件?我在 I_BuildGridViewBuildControl:

中特别引用了以下 using 语句
using System.Web; 
using System.Web.UI;
using System.Web.UI.WebControls;

这是我设置界面的方式:

public interface I_BuildGridView
    {
        void ShowControls(GridViewRowEventArgs e);

    }

public class BuildControls: I_BuildGridView 
    {
      public void ShowControls(GridViewRowEventArgs e)
      {//switch statement here -it's very long so left out here…}
    }  

public partial class Class2 : System.Web.UI.Page
    {     
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            { 
                 //Call interface here
                 I_BuildGridView oShow = new BuildControls();
                oShow.ShowControls(e);//<--error here CS1503 red sqiggly under the e
            }

仅供参考:我使用 this 参考构建界面

我考虑过删除这个问题,但将由版主自行决定。考虑之后,我意识到 Page_Load() 事件不是调用 ShowControls() 方法的地方,而是 GridViews 的 RowDataBound 事件——因为对参数的引用可以从那里获得,但不知道但在 Page_Load() 事件中。至少那是我的推理。如果我错了请告诉我。