开发者

gridview data source to datatable

I have the following line of code that returning a null:

DataTable TheGridData =  (DataTable)MyGrid.DataSource;

What's the problem?

BTW, I'm looking to extract the datasource of a gridview, put it in this datatable, sort the datatable according to parameters and then bind the datatable back to the gridview. Is this the most efficient开发者_如何学JAVA way to do it?

Thanks


have a look this may help: http://www.codeproject.com/KB/aspnet/GridView_To_DataTable.aspx


The Type of the MyGrid datasource must not be a DataTable, so you will not be able to cast it to an object of type DataTable

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜