473,703 Members | 2,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Caching DataGrid Page

Hi All,

I'm having a problem with Page Output caching on a page that contains a
DataGrid. Basically the page pulls up some data for sales information from
the DB. Some of this has to be calculated on the fly when the request is
made, and so I thought it would be ideal to cache the page for a set amount
of time. I've placed the following at the top of my page: <%@ OutputCache
Duration="160" VaryByParam="No ne" %>
Now the problem is that this works fine if I am just looking at the
DataGrid, however it also needs to be editable. Once I click on the edit
link on the relevant row the page goes into the EditItemTemplat e view and
stay's cached like this for the set period of time! Nothing can be done on
the page until the cache expires.

Is there a way of setting the caching policy to cache only when the DataGrid
is not in edit mode?
Nov 18 '05 #1
3 1638
Unfortunately, the caching model does not support this. You can "cache" the
data yourself, using a static (Shared VB.NET) method, but you will likely
cache data only, and not the actual grid. If the data is the same across all
sessions, until edited, you can use the Singleton pattern to store the data
and set a cache release time on the Singleton object (hits after this time
force a requery). You can then allow the data to be edited and stored in the
Singleton, as well as updated in the database.

None of this is automagic. You will have to write it.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** *************** *************** **********
Think Outside the Box!
*************** *************** *************** *************** **********
"Janaka" <ja****@magical ia.com> wrote in message
news:eJ******** ******@TK2MSFTN GP12.phx.gbl...
Hi All,

I'm having a problem with Page Output caching on a page that contains a
DataGrid. Basically the page pulls up some data for sales information from the DB. Some of this has to be calculated on the fly when the request is
made, and so I thought it would be ideal to cache the page for a set amount of time. I've placed the following at the top of my page: <%@ OutputCache Duration="160" VaryByParam="No ne" %>
Now the problem is that this works fine if I am just looking at the
DataGrid, however it also needs to be editable. Once I click on the edit
link on the relevant row the page goes into the EditItemTemplat e view and
stay's cached like this for the set period of time! Nothing can be done on the page until the cache expires.

Is there a way of setting the caching policy to cache only when the DataGrid is not in edit mode?

Nov 18 '05 #2
Yeah about the same as what I was thinking. Do you think it would be
possible though to use the VaryByParam setting to vary by what the datagrid
clicks send to the browser?

"Cowboy (Gregory A. Beamer)" <No************ @comcast.netNoS pamM> wrote in
message news:er******** ******@TK2MSFTN GP10.phx.gbl...
Unfortunately, the caching model does not support this. You can "cache" the data yourself, using a static (Shared VB.NET) method, but you will likely
cache data only, and not the actual grid. If the data is the same across all sessions, until edited, you can use the Singleton pattern to store the data and set a cache release time on the Singleton object (hits after this time
force a requery). You can then allow the data to be edited and stored in the Singleton, as well as updated in the database.

None of this is automagic. You will have to write it.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** *************** *************** **********
Think Outside the Box!
*************** *************** *************** *************** **********
"Janaka" <ja****@magical ia.com> wrote in message
news:eJ******** ******@TK2MSFTN GP12.phx.gbl...
Hi All,

I'm having a problem with Page Output caching on a page that contains a
DataGrid. Basically the page pulls up some data for sales information

from
the DB. Some of this has to be calculated on the fly when the request is made, and so I thought it would be ideal to cache the page for a set

amount
of time. I've placed the following at the top of my page: <%@

OutputCache
Duration="160" VaryByParam="No ne" %>
Now the problem is that this works fine if I am just looking at the
DataGrid, however it also needs to be editable. Once I click on the edit link on the relevant row the page goes into the EditItemTemplat e view and stay's cached like this for the set period of time! Nothing can be done

on
the page until the cache expires.

Is there a way of setting the caching policy to cache only when the

DataGrid
is not in edit mode?


Nov 18 '05 #3
The following is copied from MSDN. It describe the different ways you
can control caching. It looks like the "VaryByCust om" option can do
what you need.

VaryByCustom
Any text that represents custom output caching requirements. If this
attribute is given a value of browser, the cache is varied by browser
name and major version information. If a custom string is entered, you
must override the HttpApplication .GetVaryByCusto mString method in your
application's Global.asax file.
VaryByHeader
A semicolon-separated list of HTTP headers used to vary the output
cache. When this attribute is set to multiple headers, the output
cache contains a different version of the requested document for each
specified header.
Note Setting the VaryByHeader attribute enables caching items in all
HTTP 1.1 caches, not just the ASP.NET cache. This attribute is not
supported for @ OutputCache directives in user controls.
VaryByParam
A semicolon-separated list of strings used to vary the output cache.
By default, these strings correspond to a query string value sent with
GET method attributes, or a parameter sent using the POST method. When
this attribute is set to multiple parameters, the output cache
contains a different version of the requested document for each
specified parameter. Possible values include none, *, and any valid
query string or POST parameter name.
CAUTION This attribute is required when you output cache ASP.NET
pages. It is required for user controls as well unless you have
included a VaryByControl attribute in the control's @ OutputCache
directive. A parser error occurs if you fail to include it. If you do
not want to specify a parameter to vary cached content, set the value
to none. If you want to vary the output cache by all parameter values,
set the attribute to *.
VaryByControl
A semicolon-separated list of strings used to vary a user control's
output cache. These strings represent the ID property values of
ASP.NET server controls declared in the user control. For more
information, see Caching Portions of an ASP.NET Page.
Note This attribute is required in a user control @ OutputCache
directive unless you have included a VaryByParam attribute. This
attribute is not supported for @ OutputCache directives in ASP.NET
pages.

Tommy,

"Janaka" <ja****@magical ia.com> wrote in message news:<eJ******* *******@TK2MSFT NGP12.phx.gbl>. ..
Hi All,

I'm having a problem with Page Output caching on a page that contains a
DataGrid. Basically the page pulls up some data for sales information from
the DB. Some of this has to be calculated on the fly when the request is
made, and so I thought it would be ideal to cache the page for a set amount
of time. I've placed the following at the top of my page: <%@ OutputCache
Duration="160" VaryByParam="No ne" %>
Now the problem is that this works fine if I am just looking at the
DataGrid, however it also needs to be editable. Once I click on the edit
link on the relevant row the page goes into the EditItemTemplat e view and
stay's cached like this for the set period of time! Nothing can be done on
the page until the cache expires.

Is there a way of setting the caching policy to cache only when the DataGrid
is not in edit mode?

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1737
by: Troy Simpson | last post by:
Hi, I have a website which is made up of dynamic pages. Each page that's loaded has some code which looks at which template to load amongst other things, which causes the page to take a little while to be processed. At the moment I have programmatic page caching in the "loader" using paramater caching to send a cached version of every requested page back to the user. How can I get particular elements inside each page to cache without...
2
1505
by: moondaddy | last post by:
My default page stays constant in the site and all the content in the body of the page is produced with user controls in a table cell for the body section. The main function of this site is a products catalogue and the products show in a datagrid in one of the user controls. This datagrid has many rows and columns of images and this is what I'm most interested in caching. If I put <%@ OutputCache Duration="500" VaryByParam="MenuID"...
1
1382
by: Fernando Chilvarguer | last post by:
HI, I have a page that users use to search for other users on my web site. Very simple page: - 3 input Parameters (TextBoxes) - 1 DataGrid with the search results. All works fine.
2
1134
by: Raghu Raman | last post by:
Hi, In my asp .net page am using many controls and a grid.i populate many html controls innside the grid dynamically .if i click the grid ,it wll go to other page using onclick client side javascript function. I,want my grid data to be maintained in cache when i click the html button. before going to that page i want to cache my page data,so that i can
0
1034
by: Simon Prince | last post by:
Hi I have created a .NET "Windows Custom Control" which is used an ASPX Web Form. It is referenced with the code, from a ASPX page. ************************************************** <object id="myComponent" classid="http:#"
0
1251
by: syedsheeraz | last post by:
Hi all. Does anyone know if there is a way to gain programmatic access to the user control inside of a page after it has been cached? Let me elaborate more by telling you what I am doing. I am using page fragment caching to cache results of a search while the header is dynamically loaded each time. So I have a page containing a user control which contains my datagrid for displaying the results. The user control has the outputcache...
3
2485
by: DC | last post by:
Hi, (ASP.Net 1.1) is it possible to (programmatically and globally) deactivate page fragment caching? We have only two scenarios, development stage where we want caching off and testing where we want caching on. Is this doable? I think there is a config switch in 2.0, anything in 1.1? TIA for any hint,
0
962
by: Not Me | last post by:
Hi, I've just been reading about paging a datagrid, and caching the data to avoid querying a database on every page update. When using a paged gridview in asp.net 2.0 is this caching taken care of for me? cheers, Chris
3
1337
by: jlotmar | last post by:
I am currently experiencing a problem whereby browser caching seems to be causing my page to be invalid. I am using a standard DataGrid WebControl which is bound to a DataView object. I use a link in the DataGrid control to go to a details page for the record to edit a number of different fields for the record. After updating the dataset and database, I use a response.redirect (I’ve also tried Server.Transfer) to return to the first...
0
8750
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8662
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9244
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9004
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7853
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6585
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4679
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2439
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.