Showing posts with label master. Show all posts
Showing posts with label master. Show all posts

Monday, March 26, 2012

Programmatically setting EnablePartialRendering to false from master page

Hi,

I have a master page which has its content area wrapped inside an updatepanel. To facilitate debugging, I'ld like to "disable" the updatepanel when the request URL contains ?debug=true.

I understood that to disable the updatepanel, setting EnablePartialRendering to false should do the trick. This can only be done from PreInit.

The problem I'm facing now is that:

The master page doesn't have an OnPreInit method to overrideWhen I override the OnPreInit in the content page, there's no ScriptManager available (via ScriptManager.GetCurrent(Page)), since the ScriptManager is defined in the master page.

Any idea on how I can solve this without having to create 2 master pages (with & without the UpdatePanel) and dynamically switching between both?

Wouter

Locate the WebpartManger in masterpage by

this.MasterPage.FindControl("yourwebpartmangerid");


Thanks for the hint. I was able to locate the scriptmanager in this way and disable the partial rendering.

However, a new problem arose after I did all this. The page showed two assert popup boxes:

"Assertion Failed: Could not resolve reference to object named "_PageRequestManager" for "dataContext" property on object of type "Sys.Binding""

"Assertion Failed: No data context available for binding with ID "" and dataPath "inPostBack" on object of type "Sys.UI.Control""

I've tracked this down to the UpdateProgress control, which still renders xml-script while EnablePartialRendering is false (see also http://forums.asp.net/thread/1250774.aspx)

I'm now trying to programmatically remove or disable the UpgradeProgress control as well, but had no luck so far :(


hello.

ah, i remember that...well, in fact, the class has 2 bugs:

1. the 1st is that it renders xml-script without checking for its visible property
2. the 2nd is that the interface is implemented explicitly without any delegation to a protected virtual method (this would let you easilly fix this).

so, your best option is to write your own updateprogress control.

Saturday, March 24, 2012

Put the UpdateProgress into an AlwaysVisibleControl?

I already have an updateProgress in a master page as per below code..

Is it possible to somehow wrap this in another control and have this control referenced by an AlwaysVisibleControl. Therefore when a user needs to scroll down a page the update progress will always be visible.

Thanks

N

<

atlas:UpdateProgressid="loadingProgress"runat="server"><ProgressTemplate><divstyle="text-align: right;"id="loadingAnimation"><imgid="img9"src="images/indicator3.gif"title="Loading"alt=" Loading"border="0"><asp:LabelID="Label1"runat="server"Font-Names="verdana"Font-Size=8ForeColor=silverText="Working..."></asp:Label></div></ProgressTemplate></atlas:UpdateProgress>Hi niallhannon,

There shouldn't be any reason you can't do this to my knowledge... are you having a problem trying to?

Thanks,
Ted

You are right, it does work, I must have been doing something wrong.

Thanks for the reply.

N


Please share what you did. I'm trying to do the same!

Never mind. I figured it out myself. The AlwaysVisibleControlExtender needs to be inside the <ProgressTemplate> tags. For example:

<%@.RegisterAssembly="AtlasControlToolkit"Namespace="AtlasControlToolkit"TagPrefix="cc2" %>

<atlas:UpdateProgressID="ProgressIndicator"runat="server">
<ProgressTemplate>
<asp:Panelid="progressArea"runat="server">
<br/>Loading, please wait...
<asp:ImageID="LoadingImage"runat="server"ImageUrl="~/Images/spinner.gif"/>
</asp:Panel>
<cc2:AlwaysVisibleControlExtenderID="AlwaysVisible1"runat="server">
<cc2:AlwaysVisibleControlPropertiesTargetControlID="progressArea"/>
</cc2:AlwaysVisibleControlExtender>
</ProgressTemplate>
</atlas:UpdateProgress>

That works great then.


Hi Jason,

I hadto the same problem as you when I tried this last week, and ended up putting the AlwaysVisibleExtender in the ProgressTemplate.

However I found that every few updates on the same page (4 or 5?) would pop a javascript message box saying "Unspecified Error". Everything else seems to work ok.

I was wondering if you have the same problem?

~Brett


No, I've not seen any issues like that. I'm using the June CTP if that helps. I'll keep an eye on it though as its an app I'm actively developing at the moment.

Are you sure the javascript error is related to the location of the AlwaysVisibleControlExtender?


I'm Using April, perhaps it was fixed. The Javascript error was definately related to AlwaysVisibleControlExtender - once I removed that from my form the error message stops. Add it back = message returns

~Brett


Try using the June CTP. I believe there are no breaking changes (at least there wasn't for me!).

Also, could you post your AlwaysVisibleControlExtender markup? Unless its simple, maybe there's an issue within it. Just a thought.


I tried this with the June CTP and it seems it works fine.

~Brett

Question about the ScriptManagerProxy

I have a question about the ScriptManagerProxy control.

I have a .master page that uses an UpdatePanel with a ScriptManager and I want the child pages of this MasterPage to be able to use an UpdatePanel control also. I can't have another ScriptManager control on the child pages so how do I use the ScriptManagerProxy control to point to the ScriptManager on the MasterPage? Is this possible?

Thanks

Hi,

the ScriptManagerProxy is used to add references to script files and web services, but nothing prevents you to use an UpdatePanel in a child page, if you have the ScriptManager on the master page.


Oh okay. So I don't even need a ScriptManagerProxy control. I can just use the ScriptManager that I have in the .master page. I'll try it out and then let you know how it goes...Thanks!

I did what you said (pretty simple and easy, I was making it too complex) and it worked great! But, I didn't/don't have enough knowledge about the UpdatePanel that this was not exactly what I wanted it to do. I'll try to explain it as best as I can.

On my .master page I have a menu with several hyperlinks. All of these hyperlinks point to the same page (links.aspx which is a child page of the .master page) However, these hyperlinks carry with them a QueryString of data that will very depending upon which hyperlink the user clicked on. What I want to happen is this: When a user clicks on a hyperlink on the menu it will just update that part of the site with the new data that is brought in in accord with the QueryString and does not refresh the entire page. I think it might have something to do with the triggers in the UpdatePanel. Does this make any sense?

Thanks,