Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Caching / February 2006

Tip: Looking for answers? Try searching our database.

ASP.NET 2.0 Menu for downlevel browsers and caching

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dpomt - 12 Jan 2006 21:27 GMT
Hello,

does the menu control support some kind of post-cache substitution like the
adrotator control does?

I have implemented a custom caching mechanism using VaryByCustom and I am
running into problems when the menu is rendered on downlevel browsers:
if I use the navigation link "^one level up", dopostback("Sitemap","u") is
executed no matter on which level the navigation is. My
GetVaryByCustomString-Implementation (it combines some query string
parameters and __EVENTTARGET) does not see any difference when clicking on
"one level up" and the same page is used from cache. That means asking
the´menu two go one level up does not lead to any change.

It would be great if the menu control has post-cache substition support like
adrot has. If not, how could I achieve that only the menu is not cached?

Best regards,
Dieter
Luke Zhang [MSFT] - 13 Jan 2006 02:47 GMT
Hello Dieter,

The menu control doesn't support post-cache substition. Reagrding the
question ,can you explain more about how you set the menu control with "one
level up"?

Luke
dpomt - 13 Jan 2006 14:53 GMT
Hello Luke,

I will try to explain in detail what is happening and how you could
reproduce it:

1.
Create a web.sitemap file with the following content:

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
   <siteMapNode url="" title="Virtual topic (not displayed)"  description="">
     <siteMapNode url="" title="Topic 1"  description="" >
       <siteMapNode url="" title="Topic 1.1"  description="" />
       <siteMapNode url="" title="Topic 1.2"  description="" />
     </siteMapNode>
     <siteMapNode url="" title="Topic 2"  description="" >
       <siteMapNode url="" title="Topic 2.1"  description="" />
       <siteMapNode url="" title="Topic 2.2"  description="" />
     </siteMapNode>
     <siteMapNode url="" title="Topic 3"  description="" >
       <siteMapNode url="" title="Topic 3.1"  description="" />
       <siteMapNode url="" title="Topic 3.2"  description="" />
     </siteMapNode>
   </siteMapNode>

</siteMap>

2.
Make a new webform, put the following stuff in between your <form></form> tag:

<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1"
Orientation="Horizontal">
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
ShowStartingNode="False" />

3.
View that page on a downlevel browser. If you don't have one accessible, you
may also view the page in Pocket PC 2003 device emulator.
You will see the following output:
Topic 1   Topic 2   Topic 3

4.
Now, click on Topic 1. You will see the following output:
Topic 1   Topic 1.1   Topic 1.2   ^up one level

5.
Now click on "^up one level".
You should see again output as described in 3.

==> If caching is enabled with my VaryByCustom (combining some querystring
parameters), you won't see output from  but output from 4.
==> If caching is enabled with VaryByParams="*", I get the expected result
(output from 3.). However, with VaryByParams="*" always new pages are
returned when navigation through the menu. No cached pages are used.

What I need is some kind of identifier describing the current state of the
menu to be able to concatenate it to my current implementation of
GetVaryByCustom.
I cannot use __EVENTTARGET and __EVENTARGUMENT, since the first is always
the (same) id of the menu control and the latter always contains "u" when
hitting the "one level up" link, no matter in which depth of the menu
hierarchy I am.
Í thought the sitemap path would be the string I could use for that purpose:
combine the SiteMap.CurrentNode with the __EVENTARGUMENT "u". But CurrentNode
is always null.

Any suggestions what "kind of identifier describing the current state" I
could use for my GetVaryByCustom implementation?
Or: what value do I have to use for VaryByParams (I don't want "'*") to take
care about the different menu states?

TIA,
Dieter
Luke Zhang [MSFT] - 17 Jan 2006 06:33 GMT
The SiteMap.CurrentNode returns null because you didn't specify the
actually url in sitemap:

<siteMapNode url="" title="Topic 1"  description="" >

If you specify a proper value here, can you get the path information for
navigation?

Luke
dpomt - 21 Jan 2006 12:56 GMT
Luke,

> If you specify a proper value here, can you get the path information for
> navigation?
I cannot add proper values for all sitemap nodes since some of them only
serve as "group" elements. In my application, only the leave SiteMapNodes
have an url assigned.

If SiteMap.CurrentNode needs given urls, that approach won't work for me for
the described scenario.
Any other ideas how I could solve the caching issue (see my previous posts)?
Luke Zhang [MSFT] - 23 Jan 2006 06:16 GMT
I am still not very clear on this issue. If there is no actual url here,
how will a user get correct navigation when he click a item in the menu?

Luke
dpomt - 24 Jan 2006 23:18 GMT
Hello Luke,

if the user (with a downlevel browser) clicks on a node without an url, the
menuadapter just replaces the current menu items with the child menu items.

You can easily see this behavior with the sitemap file I have provided in
one of my previous posts of this thread. You might use the Pocket PC 2003
emulator if you need quickly access to a downlevel browser.

Dieter
Luke Zhang [MSFT] - 25 Jan 2006 02:50 GMT
Hello Dieter,

Thank you for the information. I have seen the same behavior with a Pocket
PC emulator in VS.NET 2005. What I mean is the menu control is just a
navigator, the user should expect the page content be changed after he
click a item on the menu. If we leave url blank here, the user will always
see same page with different menu level.

Luke Zhang
dpomt - 25 Jan 2006 08:16 GMT
Luke,

>the user should expect the page content be changed after he
>click a item on the menu.

I generally agree with you. When my menu is rendered uplevel (with the
flyout menus), those menu entries are not clickable. They are just used to
group the child menu items.
But when the menu is rendered by the MenuAdapter, those menu entries are
getting clickable to change the menu level.

I will mail you the url of a sample page containg a menu having menu entries
with empty url.

So back to my initial problem:
I need some kind of identifier describing the current state of the menu for
concatenating it to my current implementation of GetVaryByCustom.
Not having this identifier, I have to disable caching for downlevel browser
(since wrong pages would be returned by the cache when using "one level up"
to get to menu nodes with no url).

Any suggestions what "kind of identifier describing the current state" I
could use for my GetVaryByCustom implementation?
Or: what value do I have to use for VaryByParams (I don't want "'*") to take
care about the different menu states?

Thanks
Dieter
Luke Zhang [MSFT] - 26 Jan 2006 05:38 GMT
Hello,

I didn't find a proper solution only with menu control. It indeed wouldn't
tell the difference between levels. Anyway, I would like recommend you
consider the siteMapNode with a url filled. Or even a session or cookie
varaint.

Luke
dpomt - 04 Feb 2006 19:41 GMT
Hello Luke,

thanks for your post. Just to complete this thread:
like you have recommended, I have added urls for each sitemap node.
No caching issues then in downlevel browsers.

Best regards,
Dieter
dpomt - 04 Feb 2006 20:07 GMT
Luke,

my previous post was posted too fast:

>No caching issues then in downlevel browsers.
even if each sitemap node has an url, I have still no success with my
GetVaryByCustom implementation and the MenuAdapter:
if I click on a menu item that an url attached as well as submenuitems (in a
downlevel browser), the submenu items are rendered - the page contents does
not change. I need to click a second time on the menu item to make the page
url load.
This means that by just adding urls to each sitemap node does not solve my
caching issue.


Dieter
Luke Zhang [MSFT] - 06 Feb 2006 02:20 GMT
Hello,

I never saw this problem before. can you provide another sample of your
web.sitemap? Also, did it only occur with a PPC browser?

Thanks.

Luke
This posting is provided "AS IS", with no warranties, and confers no rights.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.