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

[Solved] Client and Server binding are both firing when binding to empty list

2 Answers 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Paul
Top achievements
Rank 1
Paul asked on 22 Dec 2010, 12:54 AM
I have a project where I am using a Telerik Grid (version 2010.2.825).  I am using the whole bind using server binding first then use client/ajax binding from then on.  This is a search results grid that is being bound to search results.  When the search results returns 0 items (an empty list) both the server side method and the ajax method are called.

Is there a trick to disable one of the bindings when 0 items are returned or when the grid is bound to an empty list?

Thanks,
Paul

2 Answers, 1 is accepted

Sort by
0
Paul
Top achievements
Rank 1
answered on 04 Jan 2011, 09:03 PM
Any help resolving this issue would be greatly appreciated.  If you need more information please let me know.

Thanks,
Paul
0
Marcus
Top achievements
Rank 1
answered on 07 Jul 2011, 11:05 AM
If your Server action always returns an empty IEnumerable<T> (first call) you can prevent it like this:

var first = true;
 
    function onDataBinding(e) {
        if (first) {
            e.preventDefault();
            first = false;
             return;
        }
 
        // ...
    }



Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Paul
Top achievements
Rank 1
Marcus
Top achievements
Rank 1
Share this question
or