C# 如何在asp.net web应用程序中重写usercontrol中的gridviews事件

C# 如何在asp.net web应用程序中重写usercontrol中的gridviews事件,c#,asp.net,.net,C#,Asp.net,.net,这是我的用户控制 <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Grid.ascx.cs" Inherits="WSMP.UserControls.Grid" %> <a href="#" id="lbtnAhref" runat="server">New</a> <a href="#" id="lbtnADel" runat="server"> Delete&l

这是我的用户控制

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Grid.ascx.cs" Inherits="WSMP.UserControls.Grid" %>
<a href="#" id="lbtnAhref" runat="server">New</a>
 <a href="#" id="lbtnADel" runat="server">
    Delete</a>
<asp:DropDownList ID="ddlSearchBy" runat="server">
</asp:DropDownList>
<asp:TextBox ID="txtSearchBy" runat="server"></asp:TextBox>
<asp:Button ID="btnSearchBy" runat="server" Text="Search" OnClick="btnSearchBy_Click" />
<asp:GridView ID="grdGridView" runat="server" AutoGenerateColumns="true" AllowPaging="True"
    OnPageIndexChanging="grdGridView_PageIndexChanging" PageSize="50" 
    onrowdatabound="grdGridView_RowDataBound">
</asp:GridView>

2 href,1个下拉列表,1个按钮 1格

我的计划是在多个地方或多个页面中使用这个网格。那么,如何在页面中覆盖该网格的RawDataBound呢? 假设在Page1中,如果我想做某些条件,那么我将在Page1.aspx.cs中进行编写
对于第二页,我不需要这样做。希望你能理解。

在这里查看@MayankPathak,这很让人困惑:(。从评论中,我认为仍然存在一些问题。请参阅第二篇文章……它被标记为答案。。。