我有一个用户控件作为网格视图。我正在动态添加它......我已经为数据源创建了方法,但我无法使用网格视图的其他事件,如“Row_Data_Bound”等。
我在网上看到过代码,上面写着创建委托并添加以下内容
protected void Simple_DGV_RowDataBound(object sender, GridViewRowEventArgs e)
{
OnRowDataBound(e);
}
但我在这里收到一个错误,说当前上下文中不存在名称 OnRowDataBound
任何人都可以帮助我访问父页面中用户控件网格视图的事件
编辑:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UserControl1.ascx.cs" Inherits="ProjectManagement.UserControl.User1" %>
<div>
<asp:GridView ID="ucGridView" runat="server" SkinID="gvSchedulerSkin" AllowSorting="false" OnRowDataBound="ucGridView_RowDataBound">
<RowStyle Width="20px" />
</asp:GridView>
</div>
这是我的 ascx 页面……我想在多个地方(在运行时)使用这个网格视图,所以我创建了一个用户控件……基本上我想从我的代码中调用这个用户控件,然后使用它的 rowdatabound 我想将数据与 gridview 绑定..
我在网站上看到它说使用事件冒泡......但我不知道如何实现。
那么你能帮我解决这个问题吗..这样我就可以像我一样正常使用 rowdatabound
提前谢谢
繁华开满天机
相关分类