In recent attempts to understand the ASP.NET GridView I have seen mst examples make use of a datasource declared directly in the ASPX markup. For example ...
<asp:SqlDataSource ID="productDataSource" Runat="server"
SelectCommand="SELECT [ProductName], [UnitPrice],
[UnitsInStock], [QuantityPerUnit] FROM [Products]"
ConnectionString=
"<%$ ConnectionStrings:NWConnectionString %>">
</asp:SqlDataSource>
I have seen a lot this sort of declarative datasource as opposed to the way I was taught (and personally prefer) of using ADO.NET to access data and then set the controls datasource in the code-behind.
Is there an advantage to using this new type of datasource declaration in the ASPX? What are the pros and cons?