UpdatePanel and navigation

R

Roland Dick

Hi,

this must have been asked a thousand times, but for some reason I
couldn't find anything on this..

I have an ASP.NET 2 website with a masterpage, which contains some
navigation links (partially created from a database at runtime,
partially static). What I want to achieve is that when the user clicks a
link, the ContentTemplate gets reloaded to display the new content but
the navigation links should not be re-created (i.e. avoid flicker).

Sounded like an updatepanel to me, but if the updatepanel spans around
the navigation, the navigation gets refreshed obviously; and if the
updatepanel only spans around the ContentTemplate, then the navigation
links are outside the updatepanel, causing a full post-back. Triggers
didn't help either..

There must be an easy solution and I'm just blind.. can anyone shed some
light on this?

Cheers,

Roland
 
M

Mark Rae [MVP]

this must have been asked a thousand times, but for some reason I couldn't
find anything on this..

I have an ASP.NET 2 website with a masterpage, which contains some
navigation links (partially created from a database at runtime, partially
static). What I want to achieve is that when the user clicks a link, the
ContentTemplate gets reloaded to display the new content but the
navigation links should not be re-created (i.e. avoid flicker).

Sounded like an updatepanel to me, but if the updatepanel spans around the
navigation, the navigation gets refreshed obviously; and if the
updatepanel only spans around the ContentTemplate, then the navigation
links are outside the updatepanel, causing a full post-back. Triggers
didn't help either..

There must be an easy solution and I'm just blind.. can anyone shed some
light on this?

Sounds like you're confusing MasterPages with framesets...

A MasterPage is nothing more than a particular kind of UserControl. When you
open a content page, it simply uses the MasterPage to provide common look
and feel. Moving from one content page to another content page is no
different from moving from a "normal" aspx page to another "normal" aspx
page...
 
R

Roland Dick

Hi Mark,
> Sounds like you're confusing MasterPages with framesets...

Thanks for your reply, much appreciated. Yes, I know the MasterPages
concept. I'm somewhat new to the AJAX Control Toolkit though and thought
the UpdatePanel would help me solve this problem. I think the situation
would be the same without MasterPages and the navigation being static in
each page.

What would be a proper solution to avoid re-loading the navigation then
(as obviously framesets are.. let's say outdated :) )

Cheers,

Roland
 
M

Mark Rae [MVP]

I think the situation would be the same without MasterPages and the
navigation being static in each page.

Yes it would - navigation is navigation i.e. moving from one page to another
page. Callbacks (i.e. AJAX in this case) don't involve navigation...
What would be a proper solution to avoid re-loading the navigation then
(as obviously framesets are.. let's say outdated :) )

I'm slightly confused as to what you're trying to achieve here... When you
move from page1.aspx to page2.aspx, page2.aspx is going to have to load from
scratch...

If you're trying to simulate the same sort of functionality as framesets,
this might work if all your pages are .htm - you could open them with
System.IO, strip off the <html>, <head> and <body> tags and squirt what's
left into a <div>...

Alternately, maybe an <iframe> would work.

Sounds like you're making life difficult for yourself with no discernible
(IMO!) benefit...
 
R

Roland Dick

Hi Mark,
Sounds like you're making life difficult for yourself with no
discernible (IMO!) benefit...

Yeah, that might be true. Well, the main benefit would be that clicking
a link in the navigation wouldn't cause DB queries to run (which fill
some of the navigation bar).
But I think I could as well cache the data.

Thanks for your help!

Roland
 
M

Mark Rae [MVP]

Yeah, that might be true. Well, the main benefit would be that clicking a
link in the navigation wouldn't cause DB queries to run (which fill some
of the navigation bar).
But I think I could as well cache the data.

That would definitely be the way to go if your navigation is at least static
per session...

Presumably, the links are different per (type of) user, otherwise you'd just
hardcode them, right...?
 
R

Roland Dick

Hi Mark,
Presumably, the links are different per (type of) user, otherwise you'd
just hardcode them, right...?

No, in that case I would use a LoginView control and still hardcode the
links in the according rolegrouptemplate; the links are from a database
where articles are stored, and for example the 10 most popular articles
should be displayed in the navigation under a "products" collapsible
panel (together with a static "All products" link).

The other problem is that the links cause not just a postback but a
reload of the page, making the collapsible panels loose their state. But
that is a different story...


Roland
 

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,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top