Hello,
I have a simple RadGrid using OnNeedDataSource to bind data on initial page load. And on a button (outside grid) clicked event I try to get the RadGrid datasource using code below:
01.private DataTable GetFilteredDataSource()02. {03. DataTable DT = new DataTable();04. 05. DataTable FilteredDT = new DataTable();06. string filterexpression = string.Empty;07. filterexpression = RadGrid1.MasterTableView.FilterExpression; 08. // DT = (DataTable)RadGrid1.DataSource;09. DT = RadGrid1.MasterTableView.DataSource as DataTable;10. 11. FilteredDT = DT.AsEnumerable()12. .AsQueryable()13. .Where(filterexpression)14. .CopyToDataTable();15. return FilteredDT;16. }
line 09 will give DataSource = null.
Please help. Thanks!
