1

我希望能够将参数传递给 grid_NeedDataSource。

RadGrid.NeedDataSource += new GridNeedDataSourceEventHandler(grid_NeedDataSource(Parameter i want to pass));

  void grid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e, DataTable dt)
    {
        DataTable current = dt;
        RadGrid grid = (RadGrid)sender;
        grid.DataSource = current;
    }

我希望能够将 DataTable 作为参数传递给它。我怎么能做到这一点?

4

1 回答 1

0

尝试这个:

Radgrid1.NeedDataSource += new GridNeedDataSourceEventHandler((sender, e) => grid_NeedDataSource(sender, e, "new parameter"));

protected void grid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e, string t)
{
}

编辑:为了通过 a DataTable,你可以这样做:

DataTable dt=new DataTable();
Radgrid1.NeedDataSource += new GridNeedDataSourceEventHandler((sender, e) => grid_NeedDataSource(sender, e, dt));

protected void grid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e, DataTable t)
{
}
于 2013-09-25T07:46:06.137 回答