Cannot add cache to an entitydataSource in code behind

I'm using .Net 4, Asp.Net and C#. Database is SQLServer 2008R2.I've been facing an issue when adding a caching mechanism to a few request from our application.For now, I'm using the standard way of linking my database to a grid, like this in my ASCX :And simply linking my edsMySource to my grid (Telerik RadGrid) does the job.Now, I would like to do the same in my code-behind, so I could get the object returned by the EntityDataSource and cache it.I struggle finding the proper way of doing so...In summary, I would like to :[*]Create my EntityDataSource in code behind.[*]Save this object in my cache.[*]Link my EntityDataSource object on my RadGrid.Any idea how to do this ?I already tried doing this in my page constructor :\[code\] OMSEntityDataSource toto = new OMSEntityDataSource(); toto.ID = "edsMySource"; toto.EnableDelete = false; toto.EnableUpdate = false; toto.EnableInsert = false; toto.EntitySetName = "MyTable";\[/code\]But in my OnLoad method, I get an error here :\[code\] MyGrid.Rebind();\[/code\]But I don't get it because OnLoad should be called after my constructor, hence my grid should be initialized properly.What am I missing ?
 
Back
Top