I have been trying to find an answer to this question now for days and I find it hard to believe that this can't be done.
I want to get to the DataSet/DataTable
that is built when a SqlDataSource.Select
method is called automatically by the ASP.NET run-time when a page is being built.
I know I can run it in code behind but this makes a second trip to the database and I would really like to avoid this. Every example I have come across tell you to execute the Select method in the code behind.
Is there any way to access the data that has already been retrieved?
DataAdapter.Fill(DataTable)
) or a real ORM mapper like NHibernate or Entity framework. Anyway, it's not clear why you think that "code behind makes a second trip to the database". Useif(!IsPostBack)
then. – Chavira