【发布时间】:2013-12-13 23:44:33
【问题描述】:
我目前正在将 SPGridView 绑定到 DataView。我想绑定到 ObjectDataSource,而不是使用 SPGridView 的 .DataSourceID 属性,这样我就可以在我的网格上进行过滤,这不适用于 DataView(从我读过的内容)。有没有一种简单的方法可以从 DataView 实例化 ObjectDataSource?我发现了一些相关的问题,但没有一个答案显示足够的代码上下文来让我弄清楚如何做到这一点。
这是我的代码现在的样子以及我想要做什么:
DataSet myDataSet;
myDataSet = populateDataFromDatabaseBasedOnSomeSearchParameters(startDate, endDate);
DataView myGridDataView = myDataSet.Tables[0];
// Somewhere in here convert to an ObjectDataSource so that I can bind using DataSourceID instead and get filtering to work
SPGridView myGridView;
myGridView.DataSource = myGridView;
myGridView.DataBind();
【问题讨论】:
标签: asp.net data-binding sharepoint-2010