This is a migrated thread and some comments may be shown as answers.

Ajax Manager - refresh required only for certain events

6 Answers 138 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 02 Jan 2009, 05:24 AM
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.

6 Answers, 1 is accepted

Sort by
0
Andy
Top achievements
Rank 1
answered on 02 Jan 2009, 07:17 AM
I have tried using the ajaxsetting event name property to filter out unwanted events - this appears not to work.

 
0
Atanas Korchev
Telerik team
answered on 02 Jan 2009, 10:06 AM
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.
0
Andy
Top achievements
Rank 1
answered on 03 Jan 2009, 12:38 AM
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?


0
Andy
Top achievements
Rank 1
answered on 03 Jan 2009, 01:24 AM
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

0
Andy
Top achievements
Rank 1
answered on 03 Jan 2009, 02:49 AM

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">

 

0
Andy
Top achievements
Rank 1
answered on 03 Jan 2009, 03:31 AM
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")
}

 

Tags
TreeView
Asked by
Andy
Top achievements
Rank 1
Answers by
Andy
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or