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

Cannot bind events.Databound

1 Answer 687 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Wonderer
Top achievements
Rank 1
Wonderer asked on 25 Oct 2012, 05:15 AM
Hi,

I'm trying to have a simple event that will execute on grid's databound but the grid doesn't seem to locate it.

The error is my script method is not define based on firebug

Here's my code..

@(Html.Kendo().Grid<Model>()    
    .Name("Grid")
    .Columns(columns =>
                 {
                     columns.Bound(p => p.Name);
                     columns.Bound(p => p.Allow);
                     columns.Bound(p => p.Category);
                 })
    .DataSource(dataSource => dataSource
        .Ajax()
        .Group(group => group.Add(p => p.Category))
        .Read(read => read.Action("Data""Method"))     )     .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))     .Events(events => events.DataBound("GridOnDataBound"))          )

<script type="text/javascript">
    function GridOnDataBound() {
        alert("I'm in");
    }
</script>


Beryl
Top achievements
Rank 1
commented on 24 Jun 2021, 05:31 PM

I'm having the same problem. Did you find a solution?
Ivan Danchev
Telerik team
commented on 29 Jun 2021, 12:59 PM

If you are using the Grid (or another component that you are trying to attach an event handler to) in a partial view, place the handler:

<script type="text/javascript">
    function GridOnDataBound() {
        alert("I'm in");
    }
</script>

before the component's declaration, not after it.

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 01 Nov 2012, 09:54 AM
Hello,

Please try with below link.
http://docs.kendoui.com/api/web/grid#databound

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Wonderer
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or