I' workingon an ASP.NET project and in order to populate a GridView with datat from a SQL Server Database' table I use SQLDataSource and everythings goes just fine.
But now I need to add the option to sort the columns of the gridview(ASC-Desc), for that purpose I want to use a DataView and got the next code
DataView dv = new DataView();
dv = (DataView)Ejemplo.Select(DataSourceSelectArguments.Empty);
dv.Sort = "Departmento Desc";
GridView1.DataSource = dv;
but got this error message:
Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition.
Could you please help me and tell what am I doing wrong?