Hej, Kort svar: Ja.Ajax, Viewstate
Jag har hört att dotnets implementation av ajax postar tillbaka hela sidan när man använder sig av uppdatepanels (fast man inte upplever detta som användare). Att man gör så i stället för att bara skicka den information som faktiskt förändras skall bero på att värderna även måste uppdateras i viewstate.
Jag undrar om man kommer ifrån detta om man skriver sina egna javascript som anropar en WebService? Eller måste man göra några inställnigar nånstans för att uppnå detta?Sv: Ajax, Viewstate
Gör du egna serveranrop via javascript så postas inget så länge du inte kör post av sidan.
Finns säkerligen färdiga sådan javascript på nätet om du googlar lite. Sv:MS Ajax & Viewstate, alternativ
Man kommer undan att viewstate-information skickas om du gör egna ajax-anrop mot tex en webservice... (eller varför inte ... en egen webhandler?!)
Längre svar:
Läs: MSDN Magazine artikeln UpdatePanel Tips and Tricks
http://msdn.microsoft.com/sv-se/magazine/cc163413(en-us).aspx
"For better or for worse, the UpdatePanel control is the darling of the ASP.NET AJAX community. I say "for better" because UpdatePanel makes partial-page rendering shockingly easy and "for worse" because its simplicity and ease-of-use come at the cost of efficiency and, ironically, bandwidth.
While UpdatePanel brings AJAX magic to ordinary Web pages, it doesn’t bring the efficiency we normally associate with AJAX. Did you know, for example, that when an UpdatePanel control performs an asynchronous AJAX callback to the server to update its content, the request contains everything a conventional ASP.NET postback contains, including view state? Most developers assume that AJAX eliminates view state. That’s not the case, though, with UpdatePanel’s brand of AJAX.
If you’re going to use an UpdatePanel control, you need to know what you’re getting in to. In many cases, from a performance point of view, an application is better off not using UpdatePanel and instead using asynchronous calls to WebMethods or page methods. Doing so can reduce the volume of data traveling over the wire by an order of magnitude or more. However, it’s also a fundamental shift where the UI updates need to be handled explicitly by the developer with JavaScript in the page.
In addition, ASP.NET AJAX discussion forums are already filled with questions about customizing UpdatePanel. Many of these questions are easily answered once you know about PageRequestManager, the JavaScript class in the Microsoft® AJAX Library that provides the client-side support for UpdatePanels.
Now that ASP.NET AJAX has shipped, I’d like to examine UpdatePanel more closely—taking a close look at how you can customize it, optimize it, and even live without it. And that’s exactly what this column is all about."
...
// Lycka till