how to cache part of a page without using fragment caching

S

sam

Hi,
I know fragment caching where you can use a cached user control in a
non-cached page (or the opposite)

But without using a user control, how can I cache just a part of my
page (two datatables) but not the rest of the page ?
 
K

Karl Seguin [MVP]

Well, if you actually want to cache objects, such as DataTables, you can use
the cache API,

function GetDate() as DataTable
dim cacheKey as string = "SomeUniqueKey"
dim dt as DataTable = ctype(Cache(cacheKey), DataTable)
if (dt is nothing) then
dt = getTheDataFromTheDatabase()
Cache.Insert(cacheKey, dt, null, DateTime.Now.AddMinutes(10),
Timespan.Zero)
end if
return dt
end function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top