Tag - DataTable

How to convert SqlDataSource to DataTable and DataView in C#.NET

Sometimes I want to use SqlDataSource  returned data programmatically and here is how you can do this, In this example I will assume that SqlDataSource  ID is SqlDataSource1 which is the default ID: DataSourceSelectArguments args = new DataSourceSelectArguments(); DataView view = SqlDataSource1.Select(args) as DataView; DataTable dt = view.ToTable();