Can I pass a parameter on grid's databound event?

11,649

Solution 1

function onDataBound(arg) {
   alert(arg.sender.element[0].id);
}

Solution 2

Try this,

function onDataBound(arg) {
    this.wrapper.attr('id');
}

Grid

  @(Html.Kendo().Grid<TwoModelInSinglePageModel.SampleModel>()
    .Name("grid12")
         .Events(events => events.DataBound("onDataBound"))
       .DataSource(dataSource => dataSource
        .Ajax()
            .Model(model => model.Id(p => p.inx))
           //.PageSize(1)
            .Read(read => read.Action("Read", "Test"))
     )
)

You can find id of grid. Ex:My grid id="grid12"

Share:
11,649
flower
Author by

flower

I like Java and C#.Now I am studying Android.

Updated on July 09, 2022

Comments

  • flower
    flower almost 2 years

    Now I write the event three times:

    code snippet

    I have 3 grid in a view page,I use databound .Events(events => events.DataBound("onDataBound") on each gird,Can I pass a parameter on the databound event. code snippet