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

Multiple DataBound events - Same grid

5 Answers 427 Views
Grid
This is a migrated thread and some comments may be shown as answers.
michel
Top achievements
Rank 1
michel asked on 05 Aug 2013, 12:13 PM
.Events(e => e
            .DataBound("alert('hi 1 ')")
            .DataBound("alert('hi 2')")
        );

Is it normal that we cant use the fluent eventbuilder with multiple events (same event type) ?

Kind regards,
Bart,

5 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 06 Aug 2013, 09:14 AM
Hello,

As per your code it will only fire "alert hi 2".
Because Firstly you have assigned "alert hi 1" then you have overwrite this with "alert hi 2". so it will fired only "alert hi 2".

Thanks.
Jayesh Goyani
0
jeff
Top achievements
Rank 1
answered on 17 Apr 2016, 02:53 AM

So how can multiple events be assigned to DataBound and fire using the example

.Events(e => e
            .DataBound("alert('hi 1 ')")
            .DataBound("alert('hi 2')")
        );

0
Boyan Dimitrov
Telerik team
answered on 20 Apr 2016, 07:50 AM

Hello jeff,

Multiple DataBound events for same grid is not supported scenario. I would suggest to use one event handler and implement some conditional statement to check and execute the desired code. 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Nani
Top achievements
Rank 1
answered on 12 Apr 2017, 08:24 PM

HI Jeff,

For

.Events(e => e
            .DataBound("alert('hi 1 ')")
            .DataBound("alert('hi 2')")
        );

I ran into the same problem and I solved it like this. The both functions will be executed.

.Events(a => a.DataBound(@<text>function(e){  function1(); function2(); }</text>))

 

In Scripts(same page.cshtml):

function function1(){

    alert('hi 1 ');

}

function function2(){

alert('hi 2 ');

}

 

 

0
Stefan
Telerik team
answered on 17 Apr 2017, 06:43 AM
Hello Nani,

Thank you for sharing a solution with the Kendo UI community.

This is highly appreciated.

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
Tags
Grid
Asked by
michel
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
jeff
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Nani
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or