Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 486
flower Avatar asked Dec 25 '22 22:12

flower


2 Answers

function onDataBound(arg) {
   alert(arg.sender.element[0].id);
}
like image 81
Lyly Avatar answered Jan 11 '23 23:01

Lyly


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"

like image 22
Jaimin Avatar answered Jan 11 '23 23:01

Jaimin