我的事件处理程序不会被触发

时间:2018-04-24 13:13:13

标签: c# asp.net event-handling asp.net-ajax

我正在尝试服务器端将事件处理程序绑定到我通过服务器端创建的网格中。但是事件处理程序似乎没有被触发。我在RadGrid_Equipment_ExcelExportCellFormatting事件/方法中放了一个断点,但程序不会进入事件/方法。我错过了什么吗?

public void blabla()
{     
    using (RadGrid dg = new RadGrid())
    {
        dg.DataSource = dt;

        dg.ExportSettings.IgnorePaging = true;
        dg.ExportSettings.OpenInNewWindow = true;
        dg.ExportSettings.Excel.Format = GridExcelExportFormat.Xlsx;
        dg.ExportSettings.Excel.DefaultCellAlignment = HorizontalAlign.Center;
        dg.ExportSettings.ExportOnlyData = true;            
        dg.DataBind();
        Page.Controls.Add(dg);
        dg.ExcelExportCellFormatting += new OnExcelExportCellFormattingEventHandler(RadGrid_Equipment_ExcelExportCellFormattin);
        dg.MasterTableView.ExportToExcel();
    }
}

private void RadGrid_Equipment_ExcelExportCellFormattin(object sender, ExcelExportCellFormattingEventArgs e)
{

}

0 个答案:

没有答案