Saturday, March 10, 2012

Use updatepanel for content page

Masterpages are not like frames... They are basically just templates to all the pages look the same with a little amount of code. You would probably just want to use iFrames on a regular aspx page or I have also heard of people having usercontrols for each page instead of using iFrames.


Thanks,

So does that mean ajax can't help here to get what I want, i.e. just update the content page? What can be done to reduce the flickering page reload when selecting menu items from the master page?


Hi,

When using UpdatePanel with MasterPages, you must use ScriptManager Proxy which helps in having an additional ScriptManager tag in the content page in addition to the ScriptManager tag in the master page.

However, in your case, your menu item click should reload a new page (you need to navigate to another page). What and where is the flicker that you want to avoid? If it is in the section of Master Page, yes you can. If it is in the content page which needs to change, then it doesnt look feasible.

May be you can clarify more on this?


When you load a new content page with masterpages, it is a whole different page. Masterpages just act as a wrapper on the page, and are not separated as frames are. You can try what I suggested or I have heard of a 3rd party setup that you can use, but it was basically the same thing though.


" If it is in the section of Master Page, yes you can."

Can Ajax help here?

Thanks


bgiao

I am having a same issue.. my post subject: 2 content holders..

Even after using ProxyManager I can not refresh contents (sections) within Master Page.

Guys, can you explain a bit?

Thanks, always.


Section is different from content area. You CAN use Ajax on a masterpage, BUT masterpages just get add to content pages. You don't navigate to a masterpage as you would if you were using frames. For example, we have a link on the bottom of our pages where users click to open a form that can send a comment about the current page. That can be added to a masterpage, but you can't change the content page because you are on the content page, not the masterpage. You aren't posting back the page, but going to a new one.


mdenn.. you wrote: "That can be added to a masterpage, but you can't change the content page because you are on the content page, not the masterpage. You aren't posting back the page, but going to a new one."

Here is exactly what I am trying:
Lets forget about Master and content pages. I have a page with 2 content holders (Left & Main). I have a hyperlink in Left content, which should update/ refresh left content (I use update panel for this). When I click on this link in left content I get an error: ControlId Hyperlink1 for UpdatePanel1 trigger not found. If I bring the same hyperlink in Main content page works fine..

How to resolve this issue?

SamEmbarrassed


You can't forget about Masterpages and content pages with what you are doing because that is where your problem is. At the very least you will have to do a few find controls, but even then I am not 100% sure you could even trigger an update on a masterpage with an event on the content page. You have to set the trigger in the code behind because it will not be able to automatically see it.


I said forget about Master & Content because Hyperlink1 in content1 is not able to update an image in content 2. Both contents are custom and not connected to Master template.

If I am still not following, please suggest if there is a way to achieve effect below:

Have 2 custom contents -- Hyperlinks in first and an image box in updatepanel in the other. Based on which link is clicked, only updatepanel and thus, image should refresh.

Appreciate your help.


If you have everything in 1 aspx page, it should work. Personally, I would have a gridview or other data control with the links as link buttons. Have the link buttons select the row. Use the select event to trigger the update panel. You could set the image url on the selected index changed event. You may also need to have the gridview in its own update panel for that to work... Whether or not you will do it that way, is up to you, but that is what I would suggest.


Okay.. for now I consider that this type of update does not work in 2 content pages.

I will use a simple aspx page. Thank you.

No comments:

Post a Comment