Monday, March 26, 2012

probably simple but i am new - Trying to do a partial render on a master page for my navi

I am trying to learn ajax and i got off to a fairly good start but i am stuck on this one and couldnt find any answers on the net.. i understand the use of a script manager and a updatepanel i got it to work on a page with a tree and when you select a item it loads a picture into a imgbox and it works great but here is my problem

I have a master page.. on the master page it contains my navi bar. each of the 4 buttons opens a new content page (*.aspx). I am trying to set it up so the Navi bar doesnt reload everytime i open another content page.. i want just the contentplace holder to refresh.. I have tried putting a updatepanel around my navi bar but it just doesnt seem to work.. i know this is probably really simple and i want to thank everyone in advance.

Thanks

-steve

I think you were on track when u put update panel over your menu. Just make sure that the update panel UpdateMode=Conditional

This way it will only cause postback when some trigger or other method will make it to cause postback.

Here are some good tutorial on UpdatePanel and update methods.

http://www.asp.net/learn/ajax-videos/video-177.aspx <-- this one talks about conditional mode

http://www.asp.net/learn/ajax-videos/video-159.aspx

http://www.asp.net/learn/ajax-videos/video-118.aspx

Also, you can do it other way around and place an Updatepanel in your Content Holder, and set it to update based on the menu selection. This way only parts your need actually be updated in content holder.


hello.

hum, i'm not following: you're opening a new content page but you want to do that without refreshing the page presented in the browser? if that is what you want, then the answer is: cannot be done. you'll have to refactor your site so that the content is loaded through user controls. if that is not what you meant with the previous mail, please give us more information.


Luis Abreu:

hello.

hum, i'm not following: you're opening a new content page but you want to do that without refreshing the page presented in the browser? if that is what you want, then the answer is: cannot be done. you'll have to refactor your site so that the content is loaded through user controls. if that is not what you meant with the previous mail, please give us more information.

Ok.. let me try to explain it better for you..

Files:

Masterpage.master
Home.aspx
contact.aspx
services.aspx
portfolio.aspx

So all of the pages above use Masterpage.master as the master page The master page is layed like this

Top Image
Navi Bar
ContentPlaceHolder
Bottom Image

so lets say we start out at home.aspx and we want to click on the contact img (on the master page) and it goes to contact.aspx
i want to do it in a way that instead of loading contact.aspx and reloading the content of the masterpage.. it only loads the contentplace holder..

I understand what your saying but what controls would i have to use.. or maybe i set up the image the way its linked wrong i used html.. here is the code maybe i should do it another way? Now you have me really thinking.. ill tinker with it more later today but i greatly appreciate your help.. thanks


hello again.

ok, then it's option 1. i think that in this case, you'd need to refactor your site so that it only has one page. you'd need to transform home, contact, services and protofolio pages in asp.net user controls which would be loaded when you click on the menu. I've written an old post that shows how to replace the contents of an updatepanel. it might help you get starting:

http://msmvps.com/blogs/luisabreu/archive/2007/02/15/adding-controls-to-an-updatepanel-through-code.aspx


hey Luis.. ok i started using ascx and everything works fine except for the fact that now when i load a ascx file into a contentplaceholder in a updatepanel the asptreeview that i now have as a webcontrol instead of a page wont work... any ideas? it wont let me expand anything..

No comments:

Post a Comment