Ajax Manager - refresh required only for certain events

7 posts, 0 answers
  1. Andy
    Andy avatar
    34 posts
    Member since:
    Jan 2009

    Posted 01 Jan 2009 Link to this post

    With a tree view, for example, is it  possible to have a node drag cause a post back ajax style, but for a node click to to NOT cause a post back.

    So it would be 2 scenarios on tree view:

    1) Click on node initiating a refresh on another part of the page, but tree view itself remaining on screen (Nothing on the tree changes, so why bother to make it refresh).

    2) Tree view node being dragged, and need for an ajax style post back to relect new version of tree.

    So far as I can tell, the ajax manager does not allow for this. It creates call back after any interaction with tree (the initaitor) regardless of event it detects.

    Cheers,
    Andles.
  2. Andy
    Andy avatar
    34 posts
    Member since:
    Jan 2009

    Posted 02 Jan 2009 Link to this post

    I have tried using the ajaxsetting event name property to filter out unwanted events - this appears not to work.

     
  3. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 02 Jan 2009 Link to this post

    Hi Andy,

    Indeed you cannot selectively enable ajax for certain type of events. As a workaround you can use the client side events of the treeview and call the ajaxRequest client-side method of the ajax manager.

    Regards,
    Albert
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  4. Andy
    Andy avatar
    34 posts
    Member since:
    Jan 2009

    Posted 02 Jan 2009 Link to this post

    Thanks Albert. Though I'm a bit confused here - you say it cannot be done using eventname property...yet another poster (a telerik guy) says it can be done, and posted code to demonstrate it.

    Can you please explain the reason for event name property on radajax manager in this case?


  5. Andy
    Andy avatar
    34 posts
    Member since:
    Jan 2009

    Posted 02 Jan 2009 Link to this post

    This approach would appear to skip the loading panel. I'll do some investigation on how to get the loading panel to contnue working manually...but already I can see that the rapid in RAD is dissapearing!
     

    Cheers,
    Andy

  6. Andy
    Andy avatar
    34 posts
    Member since:
    Jan 2009

    Posted 02 Jan 2009 Link to this post

    You suggested trying ajaxrequest as a work around - this also appears to be failing. My ajax request works when it is the only event defined in treeview, but as soon as I add a server side event to treeview my ajaxrequest stops doing async call back (the js function still gets called, but the async callback suddenly stops happening (I know this as the javascript alert  message still apears, but the server side method call  to Thread.Sleep  no longer happen).

    Below will not work for ajaxrequest  as per onclientnodedropped - but if I remove onnodeclick="RadTreeView1_NodeClick" the ajaxrequest starts to work again. It seems I cannot use both sever side and client side at the same time??

     

     

    <telerik:RadTreeView ID="RadTreeView1" Runat="server" EnableDragAndDrop="True"

     

     

    EnableDragAndDropBetweenNodes="True" onclientnodedropped="clientDrop"

     

     

    onnodeclick="RadTreeView1_NodeClick">

     

  7. Andy
    Andy avatar
    34 posts
    Member since:
    Jan 2009

    Posted 02 Jan 2009 Link to this post

    Oddly - the callback script works for some events, like onexpanding, but not for others, like onnodedropped. To be clear, the script is alwasys called for all events - it just seems to be selective about wether or not the ajaxrequest will happen....

    Here's a test script that will and will not work based on client side event it is wired to:

    function

     

    clientTest()
    {
    var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
    alert(
    "about to call server - will be 3 seconds due to Thread.Sleep(3000)")
    ajaxManager.ajaxRequest(
    "client");
    alert(
    "Just called server")
    }

     

Back to Top