473,474 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

cache a datalist!

Hey all my second post!

wanted to know if I can cache an entire control.. this is what I have..

Webform has header, nav, footer, and Usercontrol_1. Usercontrol_1 has a
datalist and paging items ( prev, current page, next ).

I wanted to output cache for each "page" of the datalist, but I can't
seem to get it to work ( any suggestions? ). It would only cache at the
usercontrol level. so I'd get the header, nav, foot, and Usercontrol_1
but not page two of Usercontrol_1.

I want to know how I can cache multiple instances of the Usercontrol_1
for each page.

In the meanwhile I tried caching the DataList object, but when I get it
from the cache, the DataListItems don't render! any thoughts?

thanks!

p.s. I put the DataList in the cache after the .DataBind() call.

kyong
Nov 19 '05 #1
3 1687
Pls post some code..

"Kyong Kwak" wrote:
Hey all my second post!

wanted to know if I can cache an entire control.. this is what I have..

Webform has header, nav, footer, and Usercontrol_1. Usercontrol_1 has a
datalist and paging items ( prev, current page, next ).

I wanted to output cache for each "page" of the datalist, but I can't
seem to get it to work ( any suggestions? ). It would only cache at the
usercontrol level. so I'd get the header, nav, foot, and Usercontrol_1
but not page two of Usercontrol_1.

I want to know how I can cache multiple instances of the Usercontrol_1
for each page.

In the meanwhile I tried caching the DataList object, but when I get it
from the cache, the DataListItems don't render! any thoughts?

thanks!

p.s. I put the DataList in the cache after the .DataBind() call.

kyong

Nov 19 '05 #2
// Does this help? Looking at it, I noticed that the cachedObject state
is PreRendered. There isn't a way to change the state of the control
from what I know. I looked at the content and everything is there. All
the data is fine, I just don't know why it is not rendering out! THANKS!!!!

private void Page_Load(object sender, System.EventArgs e) {
if( !IsPostBack ) {
BindList();
}
else {
DataList cachedObject = ( DataList )Cache[ "cachedList" ];
if( cachedObject != null )
myDataList = cachedObject;
else
BindList();
}
}

private void BindList() {
// get bindable arraylist
myDataList.DataSource = arraylist;
myDataList.DataBind();
Cache[ "cachedList" ] = myDataList;
}

// Wired properly for ItemBind {
private void myDataList_ItemDataBound(
object sender, DataListItemEventArgs e) {

if( ( e.Item.ItemType == ListItemType.Item ) ||
( e.Item.ItemType == ListItemType.AlternatingItem ) ) {

DataList theDataList= ( DataList )sender;
ArrayList listIDs= ( ArrayList )theDataList.DataSource;
int _productID = ( int )listIDs[ e.Item.ItemIndex ];
ProdInfo info= new ProdInfo( _productID );
this.SetProductInfo( info, e.Item );
}
}
vinay wrote:
Pls post some code..

"Kyong Kwak" wrote:

Hey all my second post!

wanted to know if I can cache an entire control.. this is what I have..

Webform has header, nav, footer, and Usercontrol_1. Usercontrol_1 has a
datalist and paging items ( prev, current page, next ).

I wanted to output cache for each "page" of the datalist, but I can't
seem to get it to work ( any suggestions? ). It would only cache at the
usercontrol level. so I'd get the header, nav, foot, and Usercontrol_1
but not page two of Usercontrol_1.

I want to know how I can cache multiple instances of the Usercontrol_1
for each page.

In the meanwhile I tried caching the DataList object, but when I get it
from the cache, the DataListItems don't render! any thoughts?

thanks!

p.s. I put the DataList in the cache after the .DataBind() call.

kyong

Nov 19 '05 #3
why are u not caching the arraylist ??
And just bind the arraylist..

"Kyong Kwak" wrote:
// Does this help? Looking at it, I noticed that the cachedObject state
is PreRendered. There isn't a way to change the state of the control
from what I know. I looked at the content and everything is there. All
the data is fine, I just don't know why it is not rendering out! THANKS!!!!

private void Page_Load(object sender, System.EventArgs e) {
if( !IsPostBack ) {
BindList();
}
else {
DataList cachedObject = ( DataList )Cache[ "cachedList" ];
if( cachedObject != null )
myDataList = cachedObject;
else
BindList();
}
}

private void BindList() {
// get bindable arraylist
myDataList.DataSource = arraylist;
myDataList.DataBind();
Cache[ "cachedList" ] = myDataList;
}

// Wired properly for ItemBind {
private void myDataList_ItemDataBound(
object sender, DataListItemEventArgs e) {

if( ( e.Item.ItemType == ListItemType.Item ) ||
( e.Item.ItemType == ListItemType.AlternatingItem ) ) {

DataList theDataList= ( DataList )sender;
ArrayList listIDs= ( ArrayList )theDataList.DataSource;
int _productID = ( int )listIDs[ e.Item.ItemIndex ];
ProdInfo info= new ProdInfo( _productID );
this.SetProductInfo( info, e.Item );
}
}
vinay wrote:
Pls post some code..

"Kyong Kwak" wrote:

Hey all my second post!

wanted to know if I can cache an entire control.. this is what I have..

Webform has header, nav, footer, and Usercontrol_1. Usercontrol_1 has a
datalist and paging items ( prev, current page, next ).

I wanted to output cache for each "page" of the datalist, but I can't
seem to get it to work ( any suggestions? ). It would only cache at the
usercontrol level. so I'd get the header, nav, foot, and Usercontrol_1
but not page two of Usercontrol_1.

I want to know how I can cache multiple instances of the Usercontrol_1
for each page.

In the meanwhile I tried caching the DataList object, but when I get it
from the cache, the DataListItems don't render! any thoughts?

thanks!

p.s. I put the DataList in the cache after the .DataBind() call.

kyong

Nov 19 '05 #4

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

Similar topics

1
by: DDK | last post by:
I am wondering how to go about caching a User Control for a set period of 24 hours starting at a certain time like 3am and lasting til 3am the following day. I know you can put the Output cache...
10
by: Bharat | last post by:
Hi Folks, Suppose I have two link button on a page (say lnkBtn1 and lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically created control. And On the click event of the lnkBtn2 I...
0
by: Ados | last post by:
Hi, first of all sorry for my not very good English. I have upload button in my aspx file and when the user doing upload of image file, the image is resized and it is showed in data list. In...
4
by: Patrick.O.Ige | last post by:
I have a CheckBoxList in a DataList and i'm trying to get item Selected after doing a postBack. I have set my CheckBoxlist AutoPostBack="True" Any ideas what 'm doing wrong? It seems not to...
6
by: Paul | last post by:
I am trying to use a DataList and the ItemTemplate. I am binding the Datalist to a SQL query that gives me a list of Items with a Parent Category. I want to loop through all the items, but...
3
by: Mirek Endys | last post by:
I have DataList as part of DataList item. DataList in DataList. The parent DataList working well including Edit command, that shows Edit template and correctly bind the data into edit template...
1
by: | last post by:
I've built an application that scrapes JPG images of webpages and PDF instances of those webpages automatically from an RSS feed. References to the scraped resources are persisted to our database....
4
by: msch-prv | last post by:
Hello. I am trying to use caching to populate a datalist. The select method of the associated objectdatasource calls up GetRecipePageByRecipeCatID() to request the proper data (I am using custom...
3
by: Crazy Cat | last post by:
Hi all, I am developing an asp.net 2.0 application in Visual Studio 2005. On my page I have a simple datalist that is bound programmatically to a collection of simple objects. On this page I...
0
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...
0
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,...
1
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...
0
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...
1
muto222
php
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.