+2  A: 

If we have caching enabled, when the select method is executed, the cache is accessed before firing the Selecting event and if the data we're searching is in the cache, the select method returns with the cached data.

So if we're doing any preprocessing (ex:sorting) of the input parameters in the Selecting event caching doesn't work because the cache key created depends only on the select parameters (and its values) and paging values (as caching works with paging). Also keep in mind that caching doesn't work if we have a sort parameter.

Click here to read more

peacmaker
Thank you , Is there any way could overcome this limitation ?
Mostafa
A: 

How about this post -

http://forums.asp.net/p/1509071/3676014.aspx#3676014

I got the lead from the following two URLs:

http://www.codeproject.com/KB/aspnet/GridViewObjectDataSource.aspx http://forums.asp.net/t/1344883.aspx

In both these examples, they've implemented a generic sorting routine which handled the sorting of ODS (Obj Data Source) and with this we're able to set the ODS caching property:

EnableCaching="True"

Any expert opinions?

PS: To boost-up the performance I've the Viewstate disabled in both ODS as well as the GridView using that ODS and Caching on in ODS.

Hemant Tank