Hi guys, HtmlTable
long time no post, but now I'm in need of the help of this great community
I have some trouble with the Cache object of ASP.Net
I have a table with several 5 rows and 5 cells in each row, each containing a link to google. (demo purposes only)
I build this table dynamically and want to cache it (for several users), instead of rebuilding it during every request.
Here is how I build the table:
for (int i = 0; i < 5; i++)
HtmlTableRow tblrow = new HtmlTableRow();
for (int j = 0; j < 5; j++)
HtmlTableCell cell = new HtmlTableCell();
HtmlAnchor href = new HtmlAnchor();
href.InnerText = "Google.com";
href.HRef = http://www.google.com/">http://www.google.com;
tbl.Border = 1;
HtmlTabletbl = new HtmlTable();
Cache.Add("object", tbl, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(2,0,0), System.Web.Caching.CacheItemPriority.Normal, null); this.Controls.Add(tbl); During the onLoad, I check if the object is available in the cache. If it is, I retrieve it and add it to the page, using the following code:
tbl= (HtmlTable)this.Cache["object"]; this.Controls.Add(tbl); However, when loading the table from the cache, all HTMLAnchors inside the table are missing the href-tag.
Any ideas, why this happens? And maybe even on how to avoid it?
Thanks in Advance!