Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SqlDataSource Caching

Status
Not open for further replies.

23maploosh

Programmer
Mar 9, 2009
5
CA
I have been reading a book on ASP.net and at a point where they are talking about caching and the sqldatasource. In the book it says that the enablecaching property of the sqldatasource is by default set to false. To test this out I created a simple form with a dropdownlist populated by a sqldatasource (distinct City names from a database table). I also have a gridView that is populated by another sqldatasource. This sqlDataSource uses the City that is selected from the dropdownlist as a select parameter to grab all the employees from the selected city. I have enable caching on the second sqlDatasource (the one filling the gridview). To test this I opened my web form and selected a city (London) which in turn filled my grid view with employees in that city. I then went to sqlserver database table holding the cities and changed one of th city names. When I selected the same (London) the results were the same as before because of the caching. My problem is that the dropdownlist was not updated to show my new city. To try and troubleshoot this I ran a profiler on sqlserver and only saw the application querying one time for the distinct cities. I was under the impression that because I did not turn on caching on my sqldatasource that it would requery the datasource on every postback. Any insight would be appreciated.
Thanks
Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top