Navigation using XMLHTTPRequest

R

Roland Dick

Hi,

I have a website which has navigation links on the left. What I would
like to achieve is that a user clicks a link, the navigation bar stays
where it is and only the content gets loaded into a div; and all that
without using a frameset or an iframe. (It's a client's requirement..
you know how they are!)

Other sites do that as well: They create an XMLHTTPRequest object via JS
and write the resulting HTML (minus headers and footers) into a div. I
tried to do that and it works quite well - except for the "small"
drawback that the content ASP.NET page can not be used, i.e. clicks
trigger a postback as they should, but ASP.NET realizes that the
viewstate is wrong and throws an exception.

I'm not sure how other languages such as PHP do it, I suspect they
simply have several form tags on one page. Since you can't have two
ASP.NET forms and therefore two viewstates on a single page however, I'm
out of ideas how to solve that.

Anybody a pointer for me? :)

Thanks,

Roland
 
R

Roland Dick

Hi Peter,

thanks for your reply.
If you use a framework to do this such as Microsoft ASP.NET AJAX or
Anthem.Net, you can have your cake and eat it too.

I am not sure whether ASP.NET AJAX would help me in this situation.
After all, the navigation links are really links and therefore cause
another page to be loaded. If the link is inside say an updatepanel, it
causes the updatepanel including the menu to refresh. If the link is
outside the updatepanel, it causes the whole "new" page to be reloaded.

I am successfully using AJAX for the contentpages. It's just the
navigation that I'm struggling with, and I haven't seen a demo out so
far that has a feature of what I would like to achieve; even the toolkit
site http://asp.net/ajax/ajaxcontroltoolkit/samples/ reloads every time
you click on the navigation links on the left.

Am I missing something there?

Thanks,

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

Top