Showing posts with label pages. Show all posts
Showing posts with label pages. Show all posts

Wednesday, March 28, 2012

AJAX Update Panel Issues with Master Pages

Hello all, I am having issues using AJAX on my aspx content pages. I have a Master Page that contains a Script Manager and I want to use an Update Panel on some of my content pages. When I do this my aspx content page does not recogize any element on the page that is in the Update Panel, nor does it recognize the Update Panel. It underlines every control on the page and displays "unknown element" errors. I can still build my solution and run the app with no problems, and the AJAX seems to function correctly, but when I view the source code of the aspx page I get errors. If I try and change properties in Design view my Visual Studio locks up. If I use an Update Panel or any other Ajax extensions on a page that is not a content page of a Master Page everything works perfectly.

Is this a common problem with Master Pages? Is there a solution? I tried to search for this problem but did not turn many results. Any help or direction would be appreciated! This makes it very hard to develop. I am using Version 1.0 of ASP.Net AJAX.

Yes it is an issue a lot of people see I would assume. I just answered another post in regards to this here

http://forums.asp.net/thread/1623913.aspx

AjaxButter


Installing SP1 for Visual Studio 2005 fixed this problem.

Ajax update panel focus problem

Hi

I have a asp.net 2 web app that uses asp.net ajax and master pages. I have a very common problem that I think most people get when using an update panel and textboxes. The tab order after leaving the text box is lost, so I have heard the fix is to use

Me.ScriptManager1.SetFocus(Textbox1.ClientID);

Rather than adding the ScriptManager to every page I have added it to my Master page. However my update panel exists within a user control, which is then embeded in a master page. So the above syntax does not work in my user control as it does not know about the ScriptManager as it is defined in my master page.

Any ideas on how I could get this to work? Or any other methods to get round this textbox focus problem?

Many thanks inadvance

Use ScriptManager.GetCurrent() to get a reference to the page's ScriptManager.


See for more detail.

http://asp.net/AJAX/Documentation/Live/mref/O_T_System_Web_UI_ScriptManager_SetFocus.aspx


Hi,

You may get reference to the scriptManager instance via
ScriptManager.GetCurrent(this.Page)

Hope this helps.


I'm having a similar problem, except that I have a timer that refreshes some content every 4 seconds. I set the

this.ScriptManager1.SetFocus(tbMessage.ClientID);

but when the content refreshes, it sends the cursor to the beginning of the text box. Even when i'm in the middle of typing something.Tongue Tied

Is there a way to keep the cursor exactly where it was when content was updated in the update panel?

- Albert

(PS - Sorry to hijack this thread.)

Saturday, March 24, 2012

AJAX throw a "Sys.WebForms.PageRequestManagerErrorException" with Server.Transfer

Hi,

First, I′m from Brazil and I don′t know to write English very well, but try show my problem.

I have an application ASP NET AJAX 1.0 with 2 pages in diferent folders, how show the schemma:

Folder 1HomeFolder 2PageWithUpdatePanel

PageWithUpdatePanel contains a UpdatePanel with a Button Control named Button1.

When Home calls PageWithUpdatePanel with Server.Transfer, an error happens in browser when Button1 is pressed in a second time. Any Control causes the exception.

Details from exception message:

Sys.WebForms.PageRequestManagerErrorException: unknown error ocurred while processing the request on the server. The status code returned from the server was: 404

Another message happens with DropDownList:

Sys.WebForms.PageRequestManagerErrorException: The message received from the server cound not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near '<html xmlns="htt'.

I read that "ScriptManager1.RegisterPostBackControl(Button1)" resolves the problem. But is the same that don′t uses Ajax. That result isn′t satisfactory.

With ATLAS the error don′t happens.

The Microsoft Support has resolved the question. Past the Code after UpdatePanel: function EndRequestHandler() { theForm.action = "../NewFolder1/Default.aspx"; theForm._initialAction = theForm.action; } if( typeof(Sys) != "undefined" ) { EndRequestHandler(); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); }

I have the same issue but I wasn't able to translate the solution from the answer above. Can somebody translate the above answer into VB?

Thank you.


The code is to place in HTML Markup, not in Code-behind. Is JavaScript. The code, with line-breaks is:

function EndRequestHandler()
{
theForm.action = "../NewFolder1/Default.aspx";
theForm._initialAction = theForm.action;
}
if( typeof(Sys) != "undefined" )
{
EndRequestHandler();
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
}


Hellooo, I Have the same problem with you, can you help me how to resolve them.

where i can put that code ? can you give me the full source code ?

Thanx And Sorry My English so badBig Smile


No problem, I don′t speak English so mutch too. About the code, you have to place it in HTML markup, after the end tag of UpdatePanel.


I was trying to execute the Server.Transfer([myASPXpage]) inside the click event for my Save button. There were a couple posts on the WEB that poo pooed the idea of using Server.Transfer() in general but for my scenario it ( I thought) was necessary. After the user saved their information I wanted to return them to the main page. On the main page I was using the Request object to verify if the user was coming from a valid URI (make sure the user was signed in). Using Response.Redirect was not helpful because there wasn't a PreviousPage object to check (as there would have been if Server.Transfer was available).

In the end the solution was simple, I had overthunk the scenario by a mile. On my main page I utilized the User object checking the identity to verify that the user was signed in and valid.

Hope that makes sense...