Showing posts with label browser. Show all posts
Showing posts with label browser. Show all posts

Monday, March 26, 2012

pagerequest manager events seems to be raised to many times by the browser

Hello,

I have the next issue in my web application.

On server i'm sending to the client during a server event with registerdataitem a string -an url.

On client in pageloading i'm getting the url and showing into a popup window. This is the code:

var

wind=null;

var

currenturl=null;

var

i=0;

Sys.Application.add_load(ApplicationLoadHandler);

function

ApplicationLoadHandler(sender, args)

{

//Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(pageLoadingHandler)

}

//function EndRequestHandler(sender, args)

function

pageLoadingHandler(sender, args)

{

var dataItems = args.get_dataItems();

wind=document.getElementById(

'popupid');if (wind!=null)return;if (document.title.indexOf("Print")>=0)

currenturl=dataItems[

'ctl00_currenturl'];else

currenturl=dataItems[

'currenturl']if (currenturl !=null )//show the popup

{

wind=window.open(currenturl,

'popupid');

//DeleteFile(dataItems['currenturl']);works fine only on ie this solution

}

}

The problem is that the ajax pagerequestmanager event is raised too many times making the popup to be created to many time and sometimes browser to run out of resources.

How could i fix it i mean the pagerequestmanager event to be raised normaly i mean once.

I 'm using ie 6.5

Thanks

Hi,

Please use try this code snippet:

Sys.Application.add_load(ApplicationLoadHandler)

function ApplicationLoadHandler(sender, args)
{
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (!prm.get_isInAsyncPostBack())
{
prm.add_pageLoading(pageLoadingHandler);
}
}

Hope this helps.

Wednesday, March 21, 2012

partial rendering Post back error

Hi my application works fine in IE with partial rendering when posting back.

But When I use another Browser, some of pages are okay with partial rending, some of them I got the error message as below:

http://localhost

Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

To me these pages seems no difference when applying partial rendering. All of them use same pattern when using UpdatePanel.

Help please.

Hi,KentZhou

I am afraid we cannot find out the exact root cause without further information captured when the problem occurs.

Why don't you provide us with some source codes of the pages that get error?

To troubleshoot this issue, we really need the source code to reproduce the problem, so that we can investigate the issue in house. It is not necessary that you send out the complete source of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business logic from it.

According to the error message,I guess the problem lies on adding controls dynamically, maybe you can checkDynamicaly loading User Controls into UpdatePanel for solution and more infomation.

Let me know if you need more info.

Hope this helps.

Thank you.


Hi, Thanks for reply.

This message comes out when using Safari to run AJAX application. This application works fine when using IE or Firefox.
The page loads many ascx dynamically and using UpdatePanel with RenderMode="Inline" UpdateMode="Conditional"

Partial rendering requires a browser that supports W3C DOM Level 1.0.

We have open a new web page using atlas in some parts.

Yesterday, I have check event log of the live site www.rusgelin.net

I saw hundreds of errors.

THe exception is "Partial rendering requires a browser that supports W3C DOM Level 1.0. ".

I might create my own browser detection logic in the atlas so if browser does not support atlas, I can easly disable script manager and replace new controls with old controls.

but this solution is not feasible solution. Please explain why does the error occur?

Sahin

I saw the same error, though I use Ajax beta 1.0. if this can't be sloved, I guess i have to turn off the Ajax beta, coz all the search engine spider can't index my web site.
hello.

well, that happens because?currently?the?client?side?features?need?a?browser?with?those?caracteristics?to?correctly?render?the?pages.?getting?those?warnings?means?that?you had several?browsers?not?compatible?with?dom?level?1?loading?the?pages.
all the error message are generated by spiders from like google , yahoo... why i concern this is if those spider can not access my site correctly, then my web site can not be indexed by those search engines, that will be a big problem.

.Net 2.0 is actually fairly good at detecting browsers / bots - so you can place some logic in your base page code that checks for the bot and disables the partialrendering...following is a simple code snippett -

If (HttpContext.Current.Request.Browser.Crawler == true)

{

<control logic to over-ride displaying of content (either allow or disallow)

}

else

{

(do the normal thing)

}


oh and if you haven't read this - it gives alot more detail...on the scm / enabling detecting etc...

Sorry, but that does nothing to address this problem -- the error is coming from UpdatePanel.

-MT


With Beta2 you can if the browser supports partial rendering declaring this in the page that contains the ScriptManager:


Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
If ScriptManager1.SupportsPartialRendering = True Then
ScriptManager1.EnablePartialRendering = True
Else
ScriptManager1.EnablePartialRendering = False
End If
End Sub

Cheers,
Juan


Will this cut out this error??

-- My system is throwing 100's these errors a day -- and I haven't even launched teh site!


Will this cut out this error??

-- My system is throwing 100's these errors a day -- and I haven't even launched the site!


Yes, it will... just try it...

After adding that piece of code to the PageInit Method, use whatever error tracking tool you are using to check that it's not throwing errors anymore


Hi,

Why dont you try with Beta2 , this is a new release of ASP.NET AJAX,

and you can also get the informatin about how to convert ATLAS to Beta2 inhttp://ajax.asp.net/default.aspx

Pradeep Kumar Bura


I was using up to now the Beta1 and encountering the raised exception for all search engine. Does the default settings of the Beta2 solve this problem directly, or do we need some extra settings to change or tweak?

Thanks in advance,
Joannès


I have the same question as Joannes and want to bring this thread back to the top of the list so someone might answer from MSFT.

Will/is theEnablePartialRendering property smart enough to set itself to false if the client browser does not support partial rendering?
Or will we have to performscriptManager1.EnablePartialRendering = scriptManager1.SupportsPartialRendering; on every page that uses a script manager?


hello.

well, currently, you have to do that :(