Reduce RadAjaxManager POST size

5 posts, 0 answers
  1. Juergen Puscher
    Juergen Puscher avatar
    2 posts
    Member since:
    Jul 2009

    Posted 03 Aug 2009 Link to this post

    Hi,

    we have a big amount of Rad/ASP.NET AJAX Controls on our website. Some of them are managed by RadAjaxManager. Now when we debug the application with FireBug, we recognized that on each Ajaxified Postback there will be a POST which contains dynamic data from all controls used on the site (maybe to keep the server side up to date, Values, VIEWSTATE,... ) But this POST has a size of mminimum 500KB And we still have to add much more controls to the website.
    Currently if 10 controls produce postbacks that would mean that the Client will post 5MB of Data to the server (Not at the same time). this results in a slow behavior :-(

    Is this behavior configurable ?
    Is it possible to transfer just the data of the current control?


    thank you for answer

    regards

    Jürgen
  2. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 03 Aug 2009 Link to this post

    Hi Jürgen,

    an Ajax Postback goes through the entire lifecycle of a page.
    This means all data is present (which needs the large viewstate) all controls are there and so on.

    So this means - you get what you build :)
    Or in other words: if you have controls which need a large viewstate this will be transferred (has to be trans...).

    One idea is to limit the viewstate in general.
    Some (telerik) controls provide functionality without (or with minimal) viewstate.
    On the other hand you normally loose functionality with this approach.
    This is an example about this approach for the Rad Gridview:
    http://demos.telerik.com/aspnet-ajax/grid/examples/programming/viewstate/defaultcs.aspx

    And there you'll also find links to two other approaches:
    Viewstate compression
    http://www.telerik.com/help/aspnet-ajax/radcompression.html
    and
    Viewstate in Session
    http://www.telerik.com/help/aspnet-ajax/grdsavinggridviewstateinsession.html

    A totally different approach is to use WebMethod (Page Method) calls.
    This has very small overhead - BUT - it is nothing more than a simple call to a static (!!!! no access to controls) method with a string parameter and on the other end (on the client) a function will be called asynchronous receiving a string as parameter.
    Such an approach can be useful to do some validation, or load extra data like in this Rad Combobox example:
    http://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/autocompletesql/defaultcs.aspx

    Regards

    Manfred

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 03 Aug 2009 Link to this post

    Follow up:
    I forgot to talk about Asynchronous client script callbacks - but I guess it is better to let you first detail your needs before we get lost in AJAX :)
  5. Juergen Puscher
    Juergen Puscher avatar
    2 posts
    Member since:
    Jul 2009

    Posted 04 Aug 2009 Link to this post

    Hi Manfred,

    thank you for the quick and extensive answer.
    I hoped that there is something like the possibillity to choose between normal AJAX Request Postbacks with full Page State and  AJAX Request Postbacks without State Informations.
    So i think I've to use WebMethods provided by an additional Webservice or WCF Class. Would you prefer Webservice Class with WebMethods (asmx) or a WCF-Service (svc)?
    I already tested both and for me it looks like they both work fine. Just the Intellisense code assis for the JavaScriptProxy works only with the ASP.NET ScriptManager.
    Is there any Reason to use RadScriptManager instead of ScriptManager?

    I just tried to use RadCompression by adding
    <httpModules>
      <add name="RadCompression" type="Telerik.Web.UI.RadCompression" />
    </
    httpModules>
    to my web.config
    But if i do so, the application does not start anymore. I start the project in VisualStudio. Is this RadCompression for IIS only ?

    regards

    Alex
  6. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 04 Aug 2009 Link to this post

    Hi Jürgen,

    I'm not sure if there is a real difference between the script managers.
    I simply use the telerik but if the MS thing has positive aspects why not use this.
    --Maybe someone has better knowledge about the differences.

    Asmx is (very) simple and straight.
    WCF has much more options ("power").
    So from my point of view:
    If your services will only be used from your pages take what you prefer.
    But if you plan (or could think about a possibility) to add other "service client" later I would prefer to use WCF.

    A last few words about the "postback without state information".
    Maybe Dino Esposito's article can point you in  a different direction:
    http://msdn.microsoft.com/en-us/magazine/cc163863.aspx

    And you maybe also think about user / custom controls. The idea is to encapsulate functionality into a control which does it's job without any special needs for the containing page. I think about something like the telerik combobox which can pull data from the server when it is needed without transferring the viewstate.

    Regards

    Manfred
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017